本文整理汇总了PHP中log_update_descriptions函数的典型用法代码示例。如果您正苦于以下问题:PHP log_update_descriptions函数的具体用法?PHP log_update_descriptions怎么用?PHP log_update_descriptions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了log_update_descriptions函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tool_dbtransfer_rebuild_target_log_actions
/**
* Very hacky function for rebuilding of log actions in target database.
* @param moodle_database $target
* @param progress_trace $feedback
* @return void
* @throws Exception on conversion error
*/
function tool_dbtransfer_rebuild_target_log_actions(moodle_database $target, progress_trace $feedback = null)
{
global $DB, $CFG;
require_once "{$CFG->libdir}/upgradelib.php";
$feedback->output(get_string('convertinglogdisplay', 'tool_dbtransfer'));
$olddb = $DB;
$DB = $target;
try {
$DB->delete_records('log_display', array('component' => 'moodle'));
log_update_descriptions('moodle');
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
$plugs = get_plugin_list($type);
foreach ($plugs as $plug => $fullplug) {
$component = $type . '_' . $plug;
$DB->delete_records('log_display', array('component' => $component));
log_update_descriptions($component);
}
}
} catch (Exception $e) {
$DB = $olddb;
throw $e;
}
$DB = $olddb;
$feedback->output(get_string('done', 'core_dbtransfer', null), 1);
}
示例2: upgrade_core
/**
* Upgrade moodle core
* @param float $version target version
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_core($version, $verbose) {
global $CFG, $SITE, $DB, $COURSE;
raise_memory_limit(MEMORY_EXTRA);
require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
// Upgrade current language pack if we can
upgrade_language_pack();
print_upgrade_part_start('moodle', false, $verbose);
// Pre-upgrade scripts for local hack workarounds.
$preupgradefile = "$CFG->dirroot/local/preupgrade.php";
if (file_exists($preupgradefile)) {
core_php_time_limit::raise();
require($preupgradefile);
// Reset upgrade timeout to default.
upgrade_set_timeout();
}
$result = xmldb_main_upgrade($CFG->version);
if ($version > $CFG->version) {
// store version if not already there
upgrade_main_savepoint($result, $version, false);
}
// In case structure of 'course' table has been changed and we forgot to update $SITE, re-read it from db.
$SITE = $DB->get_record('course', array('id' => $SITE->id));
$COURSE = clone($SITE);
// perform all other component upgrade routines
update_capabilities('moodle');
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
\core\task\manager::reset_scheduled_tasks_for_component('moodle');
message_update_providers('moodle');
\core\message\inbound\manager::update_handlers_for_component('moodle');
// Update core definitions.
cache_helper::update_definitions(true);
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
// Clean up contexts - more and more stuff depends on existence of paths and contexts
context_helper::cleanup_instances();
context_helper::create_instances(null, false);
context_helper::build_all_paths(false);
$syscontext = context_system::instance();
$syscontext->mark_dirty();
print_upgrade_part_end('moodle', false, $verbose);
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例3: upgrade_core
/**
* Upgrade moodle core
* @param float $version target version
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_core($version, $verbose) {
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
require_once($CFG->libdir.'/db/upgrade.php'); // Defines upgrades
try {
// Reset caches before any output
purge_all_caches();
// Upgrade current language pack if we can
upgrade_language_pack();
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();
}
}
$result = xmldb_main_upgrade($CFG->version);
if ($version > $CFG->version) {
// store version if not already there
upgrade_main_savepoint($result, $version, false);
}
// perform all other component upgrade routines
update_capabilities('moodle');
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
message_update_providers('moodle');
// Reset caches again, just to be sure
purge_all_caches();
// Clean up contexts - more and more stuff depends on existence of paths and contexts
context_helper::cleanup_instances();
context_helper::create_instances(null, false);
context_helper::build_all_paths(false);
$syscontext = context_system::instance();
$syscontext->mark_dirty();
print_upgrade_part_end('moodle', false, $verbose);
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例4: xmldb_hotpot_upgrade
//.........这里部分代码省略.........
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('sourcefile', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('sourcetype', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('sourcelocation', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->add_field('sourcelastmodified', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('sourceetag', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('configfile', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('configlocation', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('configlastmodified', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('configetag', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('navigation', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('title', XMLDB_TYPE_INTEGER, '6', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('stopbutton', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, '0');
$table->add_field('stoptext', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('usefilters', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0');
$table->add_field('useglossary', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, null, null, '0');
$table->add_field('usemediafilter', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, '0');
$table->add_field('studentfeedback', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
$table->add_field('studentfeedbackurl', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL);
$table->add_field('timelimit', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
$table->add_field('delay3', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '-1');
$table->add_field('clickreporting', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('content', XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL);
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL);
$table->add_field('md5key', XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL);
// Add keys to table hotpot_cache
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('hotpotid', XMLDB_KEY_FOREIGN, array('hotpotid'), 'hotpot', array('id'));
// Add indexes to table hotpot_cache
$table->add_index('hotpotid-md5key', XMLDB_INDEX_NOTUNIQUE, array('hotpotid', 'md5key'));
$dbman->create_table($table);
}
// add new logging actions
log_update_descriptions('mod/hotpot');
// hotpot savepoint reached
upgrade_mod_savepoint(true, "{$newversion}", 'hotpot');
}
$newversion = 2010080302;
if ($oldversion < $newversion) {
// navigation setting of "none" is now "0" (was "6")
$DB->execute('UPDATE {hotpot} SET navigation=0 WHERE navigation=6');
// navigation's "give up" button, is replaced by the "stopbutton" field
$DB->execute('UPDATE {hotpot} SET stopbutton=0 WHERE navigation=5');
$DB->execute('UPDATE {hotpot} SET navigation=0 WHERE navigation=5');
upgrade_mod_savepoint(true, "{$newversion}", 'hotpot');
}
$newversion = 2010080303;
if ($oldversion < $newversion) {
// modify table: hotpot_attempts
$table = new xmldb_table('hotpot_attempts');
// add field: timemodified
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
$DB->execute('UPDATE {hotpot_attempts} SET timemodified = timefinish WHERE timemodified=0');
$DB->execute('UPDATE {hotpot_attempts} SET timemodified = timestart WHERE timemodified=0');
}
upgrade_mod_savepoint(true, "{$newversion}", 'hotpot');
}
$newversion = 2010080305;
if ($oldversion < $newversion) {
// modify table: hotpot
$table = new xmldb_table('hotpot');
// change fields
// - entrycm (-> signed)
// - outputformat (-> varchar)
示例5: vmoodle_upgrade_subplugins_modules
/**
* Find and check all submodules and load them up or upgrade them if necessary
*
* @global object
* @global object
*/
function vmoodle_upgrade_subplugins_modules($startcallback, $endcallback, $verbose = true)
{
global $CFG, $DB;
include $CFG->dirroot . '/local/vmoodle/db/subplugins.php';
foreach ($subplugins as $type => $subpluginpath) {
$plugindirs = glob($CFG->dirroot . '/' . $subpluginpath . '/*');
foreach ($plugindirs as $dir) {
$plug = basename($dir);
$fullplug = $dir;
if ($plug === 'CVS') {
// Someone has unzipped the template, ignore it.
continue;
}
if ($plug === 'NEWMODULE') {
// Someone has unzipped the template, ignore it.
continue;
}
// Reset time so that it works when installing a large number of plugins.
set_time_limit(600);
$component = clean_param($type . '_' . $plug, PARAM_COMPONENT);
// standardised plugin name
// Check plugin dir is valid name.
if (empty($component)) {
throw new plugin_defective_exception($type . '_' . $plug, 'Invalid plugin directory name.');
}
if (!is_readable($fullplug . '/version.php')) {
continue;
}
$plugin = new stdClass();
require $fullplug . '/version.php';
// Defines $plugin with version etc.
// If plugin tells us it's full name we may check the location.
if (isset($plugin->component)) {
if ($plugin->component !== $component) {
throw new plugin_defective_exception($component, 'Plugin installed in wrong folder.');
}
}
if (empty($plugin->version)) {
throw new plugin_defective_exception($component, 'Missing version value in version.php');
}
$plugin->name = $plug;
$plugin->fullname = $component;
if (!empty($plugin->requires)) {
if ($plugin->requires > $CFG->version) {
throw new upgrade_requires_exception($component, $plugin->version, $CFG->version, $plugin->requires);
} else {
if ($plugin->requires < 2010000000) {
throw new plugin_defective_exception($component, 'Plugin is not compatible with Moodle 2.x or later.');
}
}
}
// Try to recover from interrupted install.php if needed.
if (file_exists($fullplug . '/db/install.php')) {
if (get_config($plugin->fullname, 'installrunning')) {
require_once $fullplug . '/db/install.php';
$recover_install_function = 'xmldb_' . $plugin->fullname . '_install_recovery';
if (function_exists($recover_install_function)) {
$startcallback($component, true, $verbose);
$recover_install_function();
unset_config('installrunning', $plugin->fullname);
update_capabilities($component);
log_update_descriptions($component);
external_update_descriptions($component);
events_update_definition($component);
message_update_providers($component);
if ($type === 'message') {
message_update_processors($plug);
}
vmoodle_upgrade_plugin_mnet_functions($component, $fullplug);
// Fix wrongly twicked paths.
if ($rpc_shifted_defines = $DB->get_records_select('mnet_rpc', " xmlrpcpath LIKE 'vmoodleadminset' ", array())) {
foreach ($rpc_shifted_defines as $rpc) {
$rpc->xmlrpcpath = str_replace('vmoocleadminset', 'local/vmoodle/plugins');
$DB->update_record('mnet_rpc', $rpc);
}
}
$endcallback($component, true, $verbose);
}
}
}
$installedversion = get_config($plugin->fullname, 'version');
if (empty($installedversion)) {
// New installation.
$startcallback($component, true, $verbose);
// Install tables if defined.
if (file_exists($fullplug . '/db/install.xml')) {
$DB->get_manager()->install_from_xmldb_file($fullplug . '/db/install.xml');
}
// Store version.
upgrade_plugin_savepoint(true, $plugin->version, $type, $plug, false);
// Execute post install file.
if (file_exists($fullplug . '/db/install.php')) {
require_once $fullplug . '/db/install.php';
set_config('installrunning', 1, $plugin->fullname);
//.........这里部分代码省略.........
示例6: upgrade_core
/**
* Upgrade moodle core
* @param float $version target version
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_core($version, $verbose)
{
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
require_once $CFG->libdir . '/db/upgrade.php';
// Defines upgrades
try {
// Reset caches before any output.
cache_helper::purge_all(true);
purge_all_caches();
// Upgrade current language pack if we can
upgrade_language_pack();
print_upgrade_part_start('moodle', false, $verbose);
// Pre-upgrade scripts for local hack workarounds.
$preupgradefile = "{$CFG->dirroot}/local/preupgrade.php";
if (file_exists($preupgradefile)) {
core_php_time_limit::raise();
require $preupgradefile;
// Reset upgrade timeout to default.
upgrade_set_timeout();
}
$result = xmldb_main_upgrade($CFG->version);
if ($version > $CFG->version) {
// store version if not already there
upgrade_main_savepoint($result, $version, false);
}
// perform all other component upgrade routines
update_capabilities('moodle');
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
message_update_providers('moodle');
// Update core definitions.
cache_helper::update_definitions(true);
// Purge caches again, just to be sure we arn't holding onto old stuff now.
cache_helper::purge_all(true);
purge_all_caches();
// Clean up contexts - more and more stuff depends on existence of paths and contexts
context_helper::cleanup_instances();
context_helper::create_instances(null, false);
context_helper::build_all_paths(false);
$syscontext = context_system::instance();
$syscontext->mark_dirty();
print_upgrade_part_end('moodle', false, $verbose);
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}
示例7: upgrade_core
/**
* Upgrade moodle core
* @param float $version target version
* @param bool $verbose
* @return void, may throw exception
*/
function upgrade_core($version, $verbose)
{
global $CFG;
raise_memory_limit(MEMORY_EXTRA);
require_once $CFG->libdir . '/db/upgrade.php';
// Defines upgrades
try {
// Reset caches before any output
purge_all_caches();
// Disable the use of cache stores here. We will reset the factory after we've performed the installation.
// This ensures that we don't permanently cache anything during installation.
cache_factory::disable_stores();
// Upgrade current language pack if we can
upgrade_language_pack();
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();
}
}
$result = xmldb_main_upgrade($CFG->version);
if ($version > $CFG->version) {
// store version if not already there
upgrade_main_savepoint($result, $version, false);
}
// perform all other component upgrade routines
update_capabilities('moodle');
log_update_descriptions('moodle');
external_update_descriptions('moodle');
events_update_definition('moodle');
message_update_providers('moodle');
// Update core definitions.
cache_helper::update_definitions(true);
// Reset the cache, this returns it to a normal operation state.
cache_factory::reset();
// Purge caches again, just to be sure we arn't holding onto old stuff now.
purge_all_caches();
// Clean up contexts - more and more stuff depends on existence of paths and contexts
context_helper::cleanup_instances();
context_helper::create_instances(null, false);
context_helper::build_all_paths(false);
$syscontext = context_system::instance();
$syscontext->mark_dirty();
print_upgrade_part_end('moodle', false, $verbose);
} catch (Exception $ex) {
upgrade_handle_exception($ex);
}
}