mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
Merge branch 'MDL-25708' of git://github.com/stronk7/moodle
This commit is contained in:
commit
8afc38bd39
53 changed files with 514 additions and 526 deletions
|
@ -226,17 +226,17 @@ function xmldb_resource_upgrade($oldversion) {
|
|||
JOIN {modules} m ON m.name='resource'
|
||||
JOIN {course_modules} cm ON (cm.module = m.id AND cm.instance = r.id)";
|
||||
|
||||
if ($instances = $DB->get_recordset_sql($sql)) {
|
||||
foreach ($instances as $instance) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $instance->cmid);
|
||||
$component = 'mod_resource';
|
||||
$filearea = 'content';
|
||||
$itemid = 0;
|
||||
$filepath = file_correct_filepath(dirname($instance->mainfile));
|
||||
$filename = basename($instance->mainfile);
|
||||
file_set_sortorder($context->id, $component, $filearea, $itemid, $filepath, $filename, 1);
|
||||
}
|
||||
$instances = $DB->get_recordset_sql($sql);
|
||||
foreach ($instances as $instance) {
|
||||
$context = get_context_instance(CONTEXT_MODULE, $instance->cmid);
|
||||
$component = 'mod_resource';
|
||||
$filearea = 'content';
|
||||
$itemid = 0;
|
||||
$filepath = file_correct_filepath(dirname($instance->mainfile));
|
||||
$filename = basename($instance->mainfile);
|
||||
file_set_sortorder($context->id, $component, $filearea, $itemid, $filepath, $filename, 1);
|
||||
}
|
||||
$instances->close();
|
||||
|
||||
/// Define field mainfile to be dropped from resource
|
||||
$table = new xmldb_table('resource');
|
||||
|
|
|
@ -42,7 +42,9 @@ function resource_20_migrate() {
|
|||
$withrelativelinks = array('text/html', 'text/xml', 'application/xhtml+xml', 'application/x-shockwave-flash');
|
||||
// note: pdf doc and other types may contain links too, but we do not support relative links there
|
||||
|
||||
if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0))) {
|
||||
$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0));
|
||||
if (!$candidates->valid()) {
|
||||
$candidates->close(); // Not going to iterate (but exit), close rs
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue