Merge branch 'MDL-58684-master-rerun-upgrade-step' of https://github.com/snake/moodle

This commit is contained in:
Andrew Nicols 2017-05-08 12:30:59 +08:00
commit 5d9c1b2f8e
2 changed files with 16 additions and 16 deletions

View file

@ -2857,21 +2857,6 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017042600.01); upgrade_main_savepoint(true, 2017042600.01);
} }
if ($oldversion < 2017050300.01) {
// MDL-58684:
// Remove all portfolio_tempdata records as these may contain serialized \file_system type objects, which are now unable to
// be unserialized because of changes to the file storage API made in MDL-46375. Portfolio now stores an id reference to
// files instead of the object.
// These records are normally removed after a successful export, however, can be left behind if the user abandons the
// export attempt (a stale record). Additionally, each stale record cannot be reused and is normally cleaned up by the cron
// task core\task\portfolio_cron_task. Since the cron task tries to unserialize them, and generates a warning, we'll remove
// all records here.
$DB->delete_records_select('portfolio_tempdata', 'id > ?', [0]);
// Main savepoint reached.
upgrade_main_savepoint(true, 2017050300.01);
}
if ($oldversion < 2017050500.01) { if ($oldversion < 2017050500.01) {
// Get the list of parent event IDs. // Get the list of parent event IDs.
$sql = "SELECT DISTINCT repeatid $sql = "SELECT DISTINCT repeatid
@ -2894,5 +2879,20 @@ function xmldb_main_upgrade($oldversion) {
upgrade_main_savepoint(true, 2017050500.01); upgrade_main_savepoint(true, 2017050500.01);
} }
if ($oldversion < 2017050500.02) {
// MDL-58684:
// Remove all portfolio_tempdata records as these may contain serialized \file_system type objects, which are now unable to
// be unserialized because of changes to the file storage API made in MDL-46375. Portfolio now stores an id reference to
// files instead of the object.
// These records are normally removed after a successful export, however, can be left behind if the user abandons the
// export attempt (a stale record). Additionally, each stale record cannot be reused and is normally cleaned up by the cron
// task core\task\portfolio_cron_task. Since the cron task tries to unserialize them, and generates a warning, we'll remove
// all records here.
$DB->delete_records_select('portfolio_tempdata', 'id > ?', [0]);
// Main savepoint reached.
upgrade_main_savepoint(true, 2017050500.02);
}
return true; return true;
} }

View file

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$version = 2017050500.01; // YYYYMMDD = weekly release date of this DEV branch. $version = 2017050500.02; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches. // RR = release increments - 00 in DEV branches.
// .XX = incremental changes. // .XX = incremental changes.