本文整理汇总了PHP中core_component::get_all_versions_hash方法的典型用法代码示例。如果您正苦于以下问题:PHP core_component::get_all_versions_hash方法的具体用法?PHP core_component::get_all_versions_hash怎么用?PHP core_component::get_all_versions_hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core_component
的用法示例。
在下文中一共展示了core_component::get_all_versions_hash方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialise_cfg
/**
* Load global $CFG;
* @internal
* @static
* @return void
*/
public static function initialise_cfg() {
global $DB;
$dbhash = false;
try {
$dbhash = $DB->get_field('config', 'value', array('name'=>'phpunittest'));
} catch (Exception $e) {
// not installed yet
initialise_cfg();
return;
}
if ($dbhash !== core_component::get_all_versions_hash()) {
// do not set CFG - the only way forward is to drop and reinstall
return;
}
// standard CFG init
initialise_cfg();
}
示例2: moodle_needs_upgrading
/**
* Determine if moodle installation requires update.
*
* Checks version numbers of main code and all plugins to see
* if there are any mismatches.
*
* @return bool
*/
function moodle_needs_upgrading()
{
global $CFG;
if (empty($CFG->version)) {
return true;
}
// There is no need to purge plugininfo caches here because
// these caches are not used during upgrade and they are purged after
// every upgrade.
if (empty($CFG->allversionshash)) {
return true;
}
$hash = core_component::get_all_versions_hash();
return $hash !== $CFG->allversionshash;
}
示例3: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type=>$location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
// Mark the site as upgraded.
set_config('allversionshash', core_component::get_all_versions_hash());
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例4: store_versions_hash
/**
* Stores the version hash in both database and dataroot
*/
protected static function store_versions_hash()
{
global $CFG;
$framework = self::get_framework();
$hash = core_component::get_all_versions_hash();
// add test db flag
set_config($framework . 'test', $hash);
// hash all plugin versions - helps with very fast detection of db structure changes
$hashfile = self::get_dataroot() . '/' . $framework . '/versionshash.txt';
file_put_contents($hashfile, $hash);
testing_fix_file_permissions($hashfile);
}
示例5: upgrade_noncore
/**
* Upgrade/install other parts of moodle
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_noncore($verbose)
{
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
// upgrade all plugins types
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
$plugintypes = core_component::get_plugin_types();
foreach ($plugintypes as $type => $location) {
upgrade_plugins($type, 'print_upgrade_part_start', 'print_upgrade_part_end', $verbose);
}
// Upgrade services.
// This function gives plugins and subsystems a chance to add functions to existing built-in services.
external_update_services();
// Update cache definitions. Involves scanning each plugin for any changes.
cache_helper::update_definitions();
// Mark the site as upgraded.
set_config('allversionshash', core_component::get_all_versions_hash());
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
} catch (Exception $ex) {
upgrade_handle_exception($ex);
} catch (Throwable $ex) {
// Engine errors in PHP7 throw exceptions of type Throwable (this "catch" will be ignored in PHP5).
upgrade_handle_exception($ex);
}
}
示例6: is_site_data_updated
/**
* Returns whether test database and dataroot were created using the current version codebase
*
* @return bool
*/
public static function is_site_data_updated()
{
$datarootpath = util::get_performance_dir();
if (!is_dir($datarootpath)) {
return 1;
}
if (!file_exists($datarootpath . '/versionshash.txt')) {
return 1;
}
$hash = \core_component::get_all_versions_hash();
$oldhash = file_get_contents($datarootpath . '/versionshash.txt');
if ($hash !== $oldhash) {
return false;
}
$dbhash = get_config('core', 'perfromancesitehash');
if ($hash !== $dbhash) {
return false;
}
return true;
}