mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-41086 rework detection of necessary upgrades
This commit is contained in:
parent
166c1d74e3
commit
c5701ce7d4
5 changed files with 64 additions and 135 deletions
|
@ -137,7 +137,7 @@ abstract class testing_util {
|
|||
return false;
|
||||
}
|
||||
|
||||
$hash = self::get_version_hash();
|
||||
$hash = core_component::get_all_versions_hash();
|
||||
$oldhash = file_get_contents($datarootpath . '/versionshash.txt');
|
||||
|
||||
if ($hash !== $oldhash) {
|
||||
|
@ -195,7 +195,7 @@ abstract class testing_util {
|
|||
global $CFG;
|
||||
|
||||
$framework = self::get_framework();
|
||||
$hash = self::get_version_hash();
|
||||
$hash = core_component::get_all_versions_hash();
|
||||
|
||||
// add test db flag
|
||||
set_config($framework . 'test', $hash);
|
||||
|
@ -669,54 +669,4 @@ abstract class testing_util {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate unique version hash for all plugins and core.
|
||||
* @static
|
||||
* @return string sha1 hash
|
||||
*/
|
||||
public static function get_version_hash() {
|
||||
global $CFG;
|
||||
|
||||
if (self::$versionhash) {
|
||||
return self::$versionhash;
|
||||
}
|
||||
|
||||
$versions = array();
|
||||
|
||||
// main version first
|
||||
$version = null;
|
||||
include($CFG->dirroot.'/version.php');
|
||||
$versions['core'] = $version;
|
||||
|
||||
// modules
|
||||
$mods = core_component::get_plugin_list('mod');
|
||||
ksort($mods);
|
||||
foreach ($mods as $mod => $fullmod) {
|
||||
$module = new stdClass();
|
||||
$module->version = null;
|
||||
include($fullmod.'/version.php');
|
||||
$versions[$mod] = $module->version;
|
||||
}
|
||||
|
||||
// now the rest of plugins
|
||||
$plugintypes = core_component::get_plugin_types();
|
||||
unset($plugintypes['mod']);
|
||||
ksort($plugintypes);
|
||||
foreach ($plugintypes as $type => $unused) {
|
||||
$plugs = core_component::get_plugin_list($type);
|
||||
ksort($plugs);
|
||||
foreach ($plugs as $plug => $fullplug) {
|
||||
$plugin = new stdClass();
|
||||
$plugin->version = null;
|
||||
@include($fullplug.'/version.php');
|
||||
$versions[$plug] = $plugin->version;
|
||||
}
|
||||
}
|
||||
|
||||
self::$versionhash = sha1(serialize($versions));
|
||||
|
||||
return self::$versionhash;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue