Skip to content

Commit

Permalink
MDL-38558 add preupgrade script support
Browse files Browse the repository at this point in the history
This is intended things like undoing of local hacks, it is similar to older pre 2.0 upgrade hack.
  • Loading branch information
skodak committed Mar 19, 2013
1 parent 7112729 commit 6b4b749
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
16 changes: 7 additions & 9 deletions lib/upgradelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1518,15 +1518,13 @@ function upgrade_core($version, $verbose) {

print_upgrade_part_start('moodle', false, $verbose);

// one time special local migration pre 2.0 upgrade script
if ($CFG->version < 2007101600) {
$pre20upgradefile = "$CFG->dirroot/local/upgrade_pre20.php";
if (file_exists($pre20upgradefile)) {
set_time_limit(0);
require($pre20upgradefile);
// reset upgrade timeout to default
upgrade_set_timeout();
}
// Pre-upgrade scripts for local hack workarounds.
$preupgradefile = "$CFG->dirroot/local/preupgrade.php";
if (file_exists($preupgradefile)) {
set_time_limit(0);
require($preupgradefile);
// Reset upgrade timeout to default.
upgrade_set_timeout();
}

$result = xmldb_main_upgrade($CFG->version);
Expand Down
4 changes: 2 additions & 2 deletions local/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ are supported. There may be some extra files with special meaning in /local/.
Sample /local/ directory listing:
/local/nicehack/ - first customisation plugin
/local/otherhack/ - other customisation plugin
/local/upgrade_pre20.php - one time upgrade and migration script which is
executed before main 2.0 upgrade starts
/local/preupgrade.php - executed before each core upgrade, use $version and $CFG->version
if you need to tweak specific local hacks
/local/defaults.php - custom admin setting defaults


Expand Down

0 comments on commit 6b4b749

Please sign in to comment.