Skip to content

Commit

Permalink
MDL-58684 upgrade: re-run deletion of portfolio_tempdata upgrade step
Browse files Browse the repository at this point in the history
  • Loading branch information
snake committed May 8, 2017
1 parent 1d5a366 commit 021a143
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
30 changes: 15 additions & 15 deletions lib/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2857,21 +2857,6 @@ function xmldb_main_upgrade($oldversion) {
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) {
// Get the list of parent event IDs.
$sql = "SELECT DISTINCT repeatid
Expand All @@ -2894,5 +2879,20 @@ function xmldb_main_upgrade($oldversion) {
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;
}
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

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.
// .XX = incremental changes.

Expand Down

0 comments on commit 021a143

Please sign in to comment.