Permalink
Browse files

MDL-26616 fix broken resource modinfo caused by invalid sortorder upg…

…rade
  • Loading branch information...
1 parent 2b37004 commit 3d8f1d3abc6150f936616ecf9b5ae60966666e20 @skodak skodak committed Feb 27, 2011
Showing with 12 additions and 5 deletions.
  1. +7 −0 mod/resource/db/upgrade.php
  2. +1 −1 mod/resource/lib.php
  3. +4 −4 mod/resource/version.php
@@ -255,5 +255,12 @@ function xmldb_resource_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2010083000, 'resource');
}
+ if ($oldversion < 2011022700) {
+ // refresh resource links breakage caused by invalid sortorder
+ require_once($CFG->dirroot . '/course/lib.php');
+ rebuild_course_cache(0, true);
+ upgrade_mod_savepoint(true, 2011022700, 'resource');
+ }
+
return true;
}
View
@@ -247,7 +247,7 @@ function resource_get_coursemodule_info($coursemodule) {
return $info;
}
$fs = get_file_storage();
- $files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder');
+ $files = $fs->get_area_files($context->id, 'mod_resource', 'content', 0, 'sortorder DESC, id ASC', false); // TODO: this is not very efficient!!
if (count($files) >= 1) {
$mainfile = array_pop($files);
$info->icon = file_extension_icon($mainfile->get_filename());
View
@@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die;
-$module->version = 2010101400;
-$module->requires = 2010080300; // Requires this Moodle version
-$module->cron = 0;
-
+$module->version = 2011022700;
+$module->requires = 2010080300; // Requires this Moodle version
+$module->cron = 0;
+$module->component = 'mod_resource';

0 comments on commit 3d8f1d3

Please sign in to comment.