本文整理汇总了PHP中initialise_cfg函数的典型用法代码示例。如果您正苦于以下问题:PHP initialise_cfg函数的具体用法?PHP initialise_cfg怎么用?PHP initialise_cfg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了initialise_cfg函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: costcenter_custom_contexts_setup
/**
* Test case for custom context classes
*/
public function costcenter_custom_contexts_setup() {
global $CFG;
static $customcontexts = array(
27 => 'context_costcenter'
);
// save any existing custom contexts
$existingcustomcontexts = get_config(null, 'custom_context_classes');
set_config('custom_context_classes', serialize($customcontexts));
initialise_cfg();
context_helper::reset_levels();
$alllevels = context_helper::get_all_levels();
/// $this->assertEquals($alllevels[11], 'context_costcenter');
// clean-up & restore any custom contexts
//set_config('custom_context_classes', ($existingcustomcontexts === false) ? null : $existingcustomcontexts);
// initialise_cfg();
// context_helper::reset_levels();
// $alllevels = context_helper::get_all_levels();
// print_object($alllevels);
}
示例2: 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();
}
示例3: setup_validate_php_configuration
// Messagelib functions
require_once $CFG->libdir . '/modinfolib.php';
// Cached information on course-module instances
// make sure PHP is not severly misconfigured
setup_validate_php_configuration();
// Connect to the database
setup_DB();
// Disable errors for now - needed for installation when debug enabled in config.php
if (isset($CFG->debug)) {
$originalconfigdebug = $CFG->debug;
unset($CFG->debug);
} else {
$originalconfigdebug = -1;
}
// Load up any configuration from the config table
initialise_cfg();
// Verify upgrade is not running unless we are in a script that needs to execute in any case
if (!defined('NO_UPGRADE_CHECK') and isset($CFG->upgraderunning)) {
if ($CFG->upgraderunning < time()) {
unset_config('upgraderunning');
} else {
print_error('upgraderunning');
}
}
// Turn on SQL logging if required
if (!empty($CFG->logsql)) {
$DB->set_logging(true);
}
// Prevent warnings from roles when upgrading with debug on
if (isset($CFG->debug)) {
$originaldatabasedebug = $CFG->debug;
示例4: reset_all_data
/**
* Reset contents of all database tables to initial values, reset caches, etc.
*/
public static function reset_all_data()
{
// Reset database.
self::reset_database();
// Purge dataroot directory.
self::reset_dataroot();
// Reset all static caches.
accesslib_clear_all_caches(true);
// Reset the nasty strings list used during the last test.
nasty_strings::reset_used_strings();
filter_manager::reset_caches();
// Reset course and module caches.
if (class_exists('format_base')) {
// If file containing class is not loaded, there is no cache there anyway.
format_base::reset_course_cache(0);
}
get_fast_modinfo(0, 0, true);
// Inform data generator.
self::get_data_generator()->reset();
// Initialise $CFG with default values. This is needed for behat cli process, so we don't have modified
// $CFG values from the old run. @see set_config.
initialise_cfg();
}
示例5: costcenter_custom_contexts_setup
function costcenter_custom_contexts_setup() {
global $CFG;
static $customcontexts = array(
27 => 'context_costcenter'
);
// save any existing custom contexts
$existingcustomcontexts = get_config(null, 'custom_context_classes');
set_config('custom_context_classes', serialize($customcontexts));
initialise_cfg();
context_helper::reset_levels();
$alllevels = context_helper::get_all_levels();
}
示例6: test_customcontexts
/**
* Test case for custom context classes
*/
public function test_customcontexts()
{
global $CFG;
static $customcontexts = array(11 => 'context_bogus1', 12 => 'context_bogus2', 13 => 'context_bogus3');
// save any existing custom contexts
$existingcustomcontexts = get_config(null, 'custom_context_classes');
set_config('custom_context_classes', serialize($customcontexts));
initialise_cfg();
context_helper::reset_levels();
$alllevels = context_helper::get_all_levels();
$this->assertEquals($alllevels[11], 'context_bogus1');
$this->assertEquals($alllevels[12], 'context_bogus2');
$this->assertEquals($alllevels[13], 'context_bogus3');
// clean-up & restore any custom contexts
set_config('custom_context_classes', $existingcustomcontexts === false ? null : $existingcustomcontexts);
initialise_cfg();
context_helper::reset_levels();
}