mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-30929 detect incorrect major version upgrades
This commit is contained in:
parent
60e99097e4
commit
9008ec1654
4 changed files with 66 additions and 0 deletions
|
@ -257,6 +257,41 @@ function upgrade_plugin_savepoint($result, $version, $type, $plugin, $allowabort
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect if there are leftovers in PHP source files.
|
||||
*
|
||||
* During main version upgrades administrators MUST move away
|
||||
* old PHP source files and start from scratch (or better
|
||||
* use git).
|
||||
*
|
||||
* @return bool true means borked upgrade, false means previous PHP files were properly removed
|
||||
*/
|
||||
function upgrade_stale_php_files_present() {
|
||||
global $CFG;
|
||||
|
||||
$someexamplesofremovedfiles = array(
|
||||
// removed in 2.2dev
|
||||
'/lib/yui/3.4.1pr1/',
|
||||
// removed in 2.2
|
||||
'/search/cron_php5.php',
|
||||
'/course/report/log/indexlive.php',
|
||||
'/admin/report/backups/index.php',
|
||||
'/admin/generator.php',
|
||||
// removed in 2.1
|
||||
'/lib/yui/2.8.0r4/',
|
||||
// removed in 2.0
|
||||
'/blocks/admin/block_admin.php',
|
||||
'/blocks/admin_tree/block_admin_tree.php',
|
||||
);
|
||||
|
||||
foreach ($someexamplesofremovedfiles as $file) {
|
||||
if (file_exists($CFG->dirroot.$file)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upgrade plugins
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue