MDL-31071 blog: replace deprecated file_encode_url
Signed-off-by: Daniel Ziegenberg <[email protected]>
This commit is contained in:
@@ -27,6 +27,8 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
use core\url;
|
||||
|
||||
/**
|
||||
* Blog_entry class. Represents an entry in a user's blog. Contains all methods for managing this entry.
|
||||
* This class does not contain any HTML-generating code. See blog_listing sub-classes for such code.
|
||||
@@ -1175,8 +1177,14 @@ class blog_entry_attachment implements renderable {
|
||||
|
||||
$this->file = $file;
|
||||
$this->filename = $file->get_filename();
|
||||
$this->url = file_encode_url($CFG->wwwroot . '/pluginfile.php',
|
||||
'/' . SYSCONTEXTID . '/blog/attachment/' . $entryid . '/' . $this->filename);
|
||||
$this->url = url::make_pluginfile_url(
|
||||
contextid: SYSCONTEXTID,
|
||||
component: 'blog',
|
||||
area: 'attachment',
|
||||
itemid: $entryid,
|
||||
pathname: '/',
|
||||
filename: $this->filename
|
||||
)->out();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@ Feature: Blog entries can be added, modified and deleted
|
||||
And I follow "Add a new entry"
|
||||
And I should see "Blogs: Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | Entry 1 |
|
||||
| Blog entry body | Entry 1 content |
|
||||
| Attachment | lib/tests/fixtures/gd-logo.png |
|
||||
| Entry title | Entry 1 |
|
||||
| Blog entry body | Entry 1 content |
|
||||
| Attachment | lib/tests/fixtures/empty.txt |
|
||||
And I press "Save changes"
|
||||
|
||||
Scenario: Modify a blog entry
|
||||
@@ -24,6 +24,10 @@ Feature: Blog entries can be added, modified and deleted
|
||||
| Entry title | Blog entry 1 |
|
||||
And I press "Save changes"
|
||||
Then I should see "Blog entry 1"
|
||||
And I should see "Entry 1 content"
|
||||
And I should see "empty.txt"
|
||||
And following "empty.txt" should download a file that:
|
||||
| contains text | empty file for testing purposes |
|
||||
|
||||
Scenario: Delete a blog entry
|
||||
When I click on "Delete" "link"
|
||||
|
||||
Reference in New Issue
Block a user