mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-27448 Simplified migration of the files embedded in the resources HTML texts
This commit is contained in:
parent
afb4494bd0
commit
baa44e3d3d
@ -58,15 +58,9 @@ class moodle1_mod_folder_handler extends moodle1_resource_successor_handler {
|
||||
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_folder');
|
||||
|
||||
// migrate the files embedded into the intro field
|
||||
$files = moodle1_converter::find_referenced_files($folder['intro']);
|
||||
if (!empty($files)) {
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
foreach ($files as $file) {
|
||||
$this->fileman->migrate_file('course_files'.$file, dirname($file));
|
||||
}
|
||||
$folder['intro'] = moodle1_converter::rewrite_filephp_usage($folder['intro'], $files);
|
||||
}
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
$folder['intro'] = moodle1_converter::migrate_referenced_files($folder['intro'], $this->fileman);
|
||||
|
||||
// migrate the folder files
|
||||
$this->fileman->filearea = 'content';
|
||||
|
@ -86,26 +86,14 @@ class moodle1_mod_page_handler extends moodle1_resource_successor_handler {
|
||||
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_page');
|
||||
|
||||
// convert course files embedded into the intro
|
||||
$files = moodle1_converter::find_referenced_files($page['intro']);
|
||||
if (!empty($files)) {
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
foreach ($files as $file) {
|
||||
$this->fileman->migrate_file('course_files'.$file, dirname($file));
|
||||
}
|
||||
$page['intro'] = moodle1_converter::rewrite_filephp_usage($page['intro'], $files);
|
||||
}
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
$page['intro'] = moodle1_converter::migrate_referenced_files($page['intro'], $this->fileman);
|
||||
|
||||
// convert course files embedded into the content
|
||||
$files = moodle1_converter::find_referenced_files($page['content']);
|
||||
if (!empty($files)) {
|
||||
$this->fileman->filearea = 'content';
|
||||
$this->fileman->itemid = 0;
|
||||
foreach ($files as $file) {
|
||||
$this->fileman->migrate_file('course_files'.$file, dirname($file));
|
||||
}
|
||||
$page['content'] = moodle1_converter::rewrite_filephp_usage($page['content'], $files);
|
||||
}
|
||||
$this->fileman->filearea = 'content';
|
||||
$this->fileman->itemid = 0;
|
||||
$page['content'] = moodle1_converter::migrate_referenced_files($page['content'], $this->fileman);
|
||||
|
||||
// write page.xml
|
||||
$this->open_xml_writer("activities/page_{$moduleid}/page.xml");
|
||||
|
@ -175,19 +175,13 @@ class moodle1_mod_resource_handler extends moodle1_mod_handler {
|
||||
$this->fileman = $this->converter->get_file_manager($contextid, 'mod_resource');
|
||||
|
||||
// convert course files embedded into the intro
|
||||
$files = moodle1_converter::find_referenced_files($resource['intro']);
|
||||
if (!empty($files)) {
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
foreach ($files as $file) {
|
||||
$this->fileman->migrate_file('course_files'.$file, dirname($file));
|
||||
}
|
||||
$resource['intro'] = moodle1_converter::rewrite_filephp_usage($resource['intro'], $files);
|
||||
}
|
||||
$this->fileman->filearea = 'intro';
|
||||
$this->fileman->itemid = 0;
|
||||
$resource['intro'] = moodle1_converter::migrate_referenced_files($resource['intro'], $this->fileman);
|
||||
|
||||
// convert the referenced file itself as a main file in the content area
|
||||
$this->fileman->filearea = 'content';
|
||||
$this->fileman->itemid = 0;
|
||||
$this->fileman->itemid = 0;
|
||||
$this->fileman->migrate_file('course_files/'.$data['reference'], '/', null, 1);
|
||||
|
||||
// write resource.xml
|
||||
|
Loading…
x
Reference in New Issue
Block a user