本文整理汇总了PHP中unset_config函数的典型用法代码示例。如果您正苦于以下问题:PHP unset_config函数的具体用法?PHP unset_config怎么用?PHP unset_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了unset_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUp
protected function setUp() {
global $DB, $CFG;
$this->resetAfterTest(true);
unset_config('noemailever');
$CFG->enablecompletion = true;
$user = $this->getDataGenerator()->create_user();
$fordb = new stdClass();
$fordb->id = null;
$fordb->name = "Test badge";
$fordb->description = "Testing badges";
$fordb->timecreated = time();
$fordb->timemodified = time();
$fordb->usercreated = $user->id;
$fordb->usermodified = $user->id;
$fordb->issuername = "Test issuer";
$fordb->issuerurl = "http://issuer-url.domain.co.nz";
$fordb->issuercontact = "[email protected]";
$fordb->expiredate = null;
$fordb->expireperiod = null;
$fordb->type = BADGE_TYPE_SITE;
$fordb->courseid = null;
$fordb->messagesubject = "Test message subject";
$fordb->message = "Test message body";
$fordb->attachment = 1;
$fordb->notification = 0;
$fordb->status = BADGE_STATUS_INACTIVE;
$this->badgeid = $DB->insert_record('badge', $fordb, true);
// Create a course with activity and auto completion tracking.
$this->course = $this->getDataGenerator()->create_course(array('enablecompletion' => true));
$this->user = $this->getDataGenerator()->create_user();
$studentrole = $DB->get_record('role', array('shortname' => 'student'));
$this->assertNotEmpty($studentrole);
// Get manual enrolment plugin and enrol user.
require_once($CFG->dirroot.'/enrol/manual/locallib.php');
$manplugin = enrol_get_plugin('manual');
$maninstance = $DB->get_record('enrol', array('courseid' => $this->course->id, 'enrol' => 'manual'), '*', MUST_EXIST);
$manplugin->enrol_user($maninstance, $this->user->id, $studentrole->id);
$this->assertEquals(1, $DB->count_records('user_enrolments'));
$completionauto = array('completion' => COMPLETION_TRACKING_AUTOMATIC);
$this->module = $this->getDataGenerator()->create_module('forum', array('course' => $this->course->id), $completionauto);
// Build badge and criteria.
$fordb->type = BADGE_TYPE_COURSE;
$fordb->courseid = $this->course->id;
$fordb->status = BADGE_STATUS_ACTIVE;
$this->coursebadge = $DB->insert_record('badge', $fordb, true);
$this->assertion = new stdClass();
$this->assertion->badge = '{"uid":"%s","recipient":{"identity":"%s","type":"email","hashed":true,"salt":"%s"},"badge":"%s","verify":{"type":"hosted","url":"%s"},"issuedOn":"%d","evidence":"%s"}';
$this->assertion->class = '{"name":"%s","description":"%s","image":"%s","criteria":"%s","issuer":"%s"}';
$this->assertion->issuer = '{"name":"%s","url":"%s","email":"%s"}';
}
开发者ID:rwijaya,项目名称:moodle,代码行数:60,代码来源:badgeslib_test.php
示例2: xmldb_theme_formal_white_install
function xmldb_theme_formal_white_install()
{
// We need here to check whether or not the theme has been installed.
// If it has been installed then we need to change the name of the settings to the new names.
// If it is not installed it won't have any settings yet and we won't need to worry about this.
$currentsetting = get_config('theme_formal_white');
if (!empty($currentsetting)) {
// Remove the settings that are no longer used by this theme
// Remove regionwidth
unset_config('regionwidth', 'theme_formal_white');
// Remove alwayslangmenu
unset_config('alwayslangmenu', 'theme_formal_white');
// previous releases of formal_white them were not equipped with version number
// so I can not know if a theme specific variable exists or not.
// This is the reason why I try to use them both.
if (!empty($currentsetting->backgroundcolor)) {
// Create a new config setting called lblockcolumnbgc and give it backgroundcolor's value.
set_config('lblockcolumnbgc', $currentsetting->backgroundcolor, 'theme_formal_white');
// Remove backgroundcolor
unset_config('backgroundcolor', 'theme_formal_white');
} elseif (!empty($currentsetting->blockcolumnbgc)) {
// Create a new config setting called lblockcolumnbgc and give it blockcolumnbgc's value.
set_config('lblockcolumnbgc', $currentsetting->blockcolumnbgc, 'theme_formal_white');
// Remove blockcolumnbgc
unset_config('blockcolumnbgc', 'theme_formal_white');
}
}
return true;
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:29,代码来源:install.php
示例3: xmldb_tool_bloglevelupgrade_install
function xmldb_tool_bloglevelupgrade_install()
{
global $CFG, $OUTPUT;
// this is a hack - admins were long ago instructed to upgrade blog levels,
// the problem is that blog is not supposed to be course level activity!!
if (!empty($CFG->bloglevel_upgrade_complete)) {
// somebody already upgrades, we do not need this any more
unset_config('bloglevel_upgrade_complete');
return;
}
if (!isset($CFG->bloglevel)) {
// fresh install?
return;
}
if ($CFG->bloglevel == BLOG_COURSE_LEVEL || $CFG->bloglevel == BLOG_GROUP_LEVEL) {
// inform admins that some settings require attention after upgrade
$site = get_site();
$a = new StdClass();
$a->sitename = $site->fullname;
$a->fixurl = "{$CFG->wwwroot}/{$CFG->admin}/tool/bloglevelupgrade/index.php";
$subject = get_string('bloglevelupgrade', 'tool_bloglevelupgrade');
$description = get_string('bloglevelupgradedescription', 'tool_bloglevelupgrade', $a);
// can not use messaging here because it is not configured yet!
upgrade_log(UPGRADE_LOG_NOTICE, null, $subject, $description);
set_config('tool_bloglevelupgrade_pending', 1);
echo $OUTPUT->notification($description);
}
}
开发者ID:nigeldaley,项目名称:moodle,代码行数:28,代码来源:install.php
示例4: xmldb_enrol_license_install
function xmldb_enrol_license_install()
{
global $CFG, $DB;
// Migrate welcome message.
if (isset($CFG->sendcoursewelcomemessage)) {
// New course default.
set_config('sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, 'enrol_license');
// Each instance has different setting now.
$DB->set_field('enrol', 'customint4', $CFG->sendcoursewelcomemessage, array('enrol' => 'license'));
unset_config('sendcoursewelcomemessage');
}
// Migrate long-time-no-see feature settings.
if (isset($CFG->longtimenosee)) {
$nosee = $CFG->longtimenosee * 3600 * 24;
set_config('longtimenosee', $nosee, 'enrol_license');
$DB->set_field('enrol', 'customint2', $nosee, array('enrol' => 'license'));
unset_config('longtimenosee');
}
// Enable by default on the site.
$enabledenrols = explode(',', $CFG->enrol_plugins_enabled);
if (!in_array('license', $enabledenrols)) {
$enabledenrols[] = 'license';
set_config('enrol_plugins_enabled', implode(',', $enabledenrols));
}
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:25,代码来源:install.php
示例5: xmldb_filter_texwjax_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_filter_texwjax_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2013120300) {
$settings = array('density', 'latexbackground', 'convertformat', 'pathlatex', 'convertformat', 'pathconvert', 'pathdvips', 'latexpreamble');
// Move tex settings to config_pluins and delete entries from the config table.
foreach ($settings as $setting) {
$existingkey = 'filter_texwjax_' . $setting;
if (array_key_exists($existingkey, $CFG)) {
set_config($setting, $CFG->{$existingkey}, 'filter_texwjax');
unset_config($existingkey);
}
}
upgrade_plugin_savepoint(true, 2013120300, 'filter', 'texwjax');
}
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:papillon326,项目名称:moodle-filter_texwjax,代码行数:34,代码来源:upgrade.php
示例6: xmldb_block_section_links_upgrade
/**
* Upgrade code for the section links block.
*
* @global moodle_database $DB
* @param int $oldversion
* @param object $block
*/
function xmldb_block_section_links_upgrade($oldversion, $block)
{
global $DB;
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2013012200.0) {
// The section links block used to use its own crazy plugin name.
// Here we are converting it to the proper component name.
$oldplugin = 'blocks/section_links';
$newplugin = 'block_section_links';
// Use the proper API here... thats what we should be doing as it ensures any caches etc are cleared
// along the way!
// It may be quicker to just write an SQL statement but that would be reckless.
$config = get_config($oldplugin);
if (!empty($config)) {
foreach ($config as $name => $value) {
set_config($name, $value, $newplugin);
unset_config($name, $oldplugin);
}
}
// Main savepoint reached.
upgrade_block_savepoint(true, 2013012200.0, 'section_links');
}
// Moodle v2.5.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:42,代码来源:upgrade.php
示例7: xmldb_theme_formal_white_upgrade
function xmldb_theme_formal_white_upgrade($oldversion)
{
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012051503) {
$currentsetting = get_config('theme_formal_white');
if (isset($currentsetting->displaylogo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('headercontent', $currentsetting->displaylogo, 'theme_formal_white');
unset_config('displaylogo', 'theme_formal_white');
}
if (isset($currentsetting->logo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('customlogourl', $currentsetting->logo, 'theme_formal_white');
unset_config('logo', 'theme_formal_white');
}
if (isset($currentsetting->frontpagelogo)) {
// useless but safer
// Create a new config setting called headercontent and give it the current displaylogo value.
set_config('frontpagelogourl', $currentsetting->frontpagelogo, 'theme_formal_white');
unset_config('frontpagelogo', 'theme_formal_white');
}
upgrade_plugin_savepoint(true, 2012051503, 'theme', 'formal_white');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:34,代码来源:upgrade.php
示例8: xmldb_filter_mediaplugin_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_filter_mediaplugin_upgrade($oldversion)
{
global $CFG, $DB, $OUTPUT;
if ($oldversion < 2011030900) {
unset_config('filter_mediaplugin_enable_img');
// migrated to filter_urltolink
unset_config('filter_mediaplugin_enable_ram');
// --> rm
unset_config('filter_mediaplugin_enable_rpm');
// --> rm
unset_config('filter_mediaplugin_enable_ogg');
// --> html5audio
unset_config('filter_mediaplugin_enable_ogv');
// --> html5video
unset_config('filter_mediaplugin_enable_avi');
// --> wmp
unset_config('filter_mediaplugin_enable_wmv');
// --> wmp
unset_config('filter_mediaplugin_enable_mov');
// --> qt
unset_config('filter_mediaplugin_enable_mpg');
// --> qt
upgrade_plugin_savepoint(true, 2011030900, 'filter', 'mediaplugin');
}
return true;
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:30,代码来源:upgrade.php
示例9: xmldb_filter_mediaplugin_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_filter_mediaplugin_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2011121200) {
// Move all the media enable setttings that are now handled by core media renderer.
foreach (array('html5video', 'html5audio', 'mp3', 'flv', 'wmp', 'qt', 'rm', 'youtube', 'vimeo', 'swf') as $type) {
$existingkey = 'filter_mediaplugin_enable_' . $type;
if (array_key_exists($existingkey, $CFG)) {
set_config('core_media_enable_' . $type, $CFG->{$existingkey});
unset_config($existingkey);
}
}
// Override setting for html5 to turn it on (previous default was off; because
// of changes in the way fallbacks are handled, this is now unlikely to cause
// a problem, and is required for mobile a/v support on non-Flash devices, so
// this change is basically needed in order to maintain existing behaviour).
set_config('core_media_enable_html5video', 1);
set_config('core_media_enable_html5audio', 1);
upgrade_plugin_savepoint(true, 2011121200, 'filter', 'mediaplugin');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
return true;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:upgrade.php
示例10: xmldb_enrol_leap_upgrade
function xmldb_enrol_leap_upgrade($oldversion)
{
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012100702) {
// Set default expiry threshold to 1 day.
$DB->execute("UPDATE {enrol} SET expirythreshold = 86400 WHERE enrol = 'leap' AND expirythreshold = 0");
upgrade_plugin_savepoint(true, 2012100702, 'enrol', 'leap');
}
if ($oldversion < 2012101400) {
// Delete obsoleted settings, now using expiry* prefix to make them more consistent.
unset_config('notifylast', 'enrol_leap');
unset_config('notifyhour', 'enrol_leap');
upgrade_plugin_savepoint(true, 2012101400, 'enrol', 'leap');
}
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.5.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.6.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:briancrocker81,项目名称:moodle-enrol_leap,代码行数:29,代码来源:upgrade.php
示例11: xmldb_editor_tinymce_upgrade
function xmldb_editor_tinymce_upgrade($oldversion)
{
global $CFG, $DB;
if ($oldversion < 2014062900) {
// We only want to delete DragMath from the customtoolbar setting if the directory no longer exists. If
// the directory is present then it means it has been restored, so do not remove any settings.
if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
// Remove the DragMath plugin from the 'customtoolbar' setting (if it exists) as it has been removed.
$currentorder = get_config('editor_tinymce', 'customtoolbar');
$newtoolbarrows = array();
$currenttoolbarrows = explode("\n", $currentorder);
foreach ($currenttoolbarrows as $currenttoolbarrow) {
$currenttoolbarrow = implode(',', array_diff(str_getcsv($currenttoolbarrow), array('dragmath')));
$newtoolbarrows[] = $currenttoolbarrow;
}
$neworder = implode("\n", $newtoolbarrows);
unset_config('customtoolbar', 'editor_tinymce');
set_config('customtoolbar', $neworder, 'editor_tinymce');
}
upgrade_plugin_savepoint(true, 2014062900, 'editor', 'tinymce');
}
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v3.1.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:upgrade.php
示例12: xmldb_qtype_calculated_upgrade
function xmldb_qtype_calculated_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
$result = true;
// MDL-16505.
if ($result && $oldversion < 2008091700) {
//New version in version.php
if (get_config('qtype_datasetdependent', 'version')) {
$result = $result && unset_config('version', 'qtype_datasetdependent');
}
upgrade_plugin_savepoint($result, 2008091700, 'qtype', 'calculated');
}
// let if ($dbman->table_exists()) replace the normal $oldversion test
// as in any case the question question_calculated_options should be created
/// Define table question_calculated_options to be created
$table = new xmldb_table('question_calculated_options');
/// Adding fields to table question_calculated_options
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('question', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
$table->add_field('synchronize', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0');
/// Adding keys to table question_calculated_options
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('question', XMLDB_KEY_FOREIGN, array('question'), 'question', array('id'));
/// Conditionally launch create table for question_calculated_options
if (!$dbman->table_exists($table)) {
$result = $dbman->create_table($table);
}
/// calculated savepoint reached
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of database_manager methods
/// upgrade_plugin_savepoint($result, YYYYMMDD00, 'qtype', 'calculated');
/// }
return $result;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:35,代码来源:upgrade.php
示例13: xmldb_scorm_upgrade
/**
* @global moodle_database $DB
* @param int $oldversion
* @return bool
*/
function xmldb_scorm_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012032100) {
unset_config('updatetime', 'scorm');
upgrade_mod_savepoint(true, 2012032100, 'scorm');
}
// Adding completion fields to scorm table
if ($oldversion < 2012032101) {
$table = new xmldb_table('scorm');
$field = new xmldb_field('completionstatusrequired', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, 'timemodified');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('completionscorerequired', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, null, 'completionstatusrequired');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2012032101, 'scorm');
}
return true;
}
开发者ID:nmicha,项目名称:moodle,代码行数:30,代码来源:upgrade.php
示例14: uninstall_cleanup
/**
* Pre-uninstall hook.
*
* This is intended for disabling of plugin, some DB table purging, etc.
*
* NOTE: to be called from uninstall_plugin() only.
* @private
*/
public function uninstall_cleanup()
{
global $DB;
$DB->set_field('course', 'theme', '', array('theme' => $this->name));
$DB->set_field('course_categories', 'theme', '', array('theme' => $this->name));
$DB->set_field('user', 'theme', '', array('theme' => $this->name));
$DB->set_field('mnet_host', 'theme', '', array('theme' => $this->name));
if (get_config('core', 'thememobile') === $this->name) {
unset_config('thememobile');
}
if (get_config('core', 'themetablet') === $this->name) {
unset_config('themetablet');
}
if (get_config('core', 'themelegacy') === $this->name) {
unset_config('themelegacy');
}
$themelist = get_config('core', 'themelist');
if (!empty($themelist)) {
$themes = explode(',', $themelist);
$key = array_search($this->name, $themes);
if ($key !== false) {
unset($themes[$key]);
set_config('themelist', implode(',', $themes));
}
}
parent::uninstall_cleanup();
}
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:35,代码来源:theme.php
示例15: xmldb_scorm_upgrade
/**
* @global moodle_database $DB
* @param int $oldversion
* @return bool
*/
function xmldb_scorm_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2012032100) {
unset_config('updatetime', 'scorm');
upgrade_mod_savepoint(true, 2012032100, 'scorm');
}
// Adding completion fields to scorm table
if ($oldversion < 2012032101) {
$table = new xmldb_table('scorm');
$field = new xmldb_field('completionstatusrequired', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, 'timemodified');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
$field = new xmldb_field('completionscorerequired', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, null, 'completionstatusrequired');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2012032101, 'scorm');
}
// Moodle v2.3.0 release upgrade line
// Put any upgrade step following this
//rename config var from maxattempts to maxattempt
if ($oldversion < 2012061701) {
$maxattempts = get_config('scorm', 'maxattempts');
$maxattempts_adv = get_config('scorm', 'maxattempts_adv');
set_config('maxattempt', $maxattempts, 'scorm');
set_config('maxattempt_adv', $maxattempts_adv, 'scorm');
unset_config('maxattempts', 'scorm');
//remove old setting.
unset_config('maxattempts_adv', 'scorm');
//remove old setting.
upgrade_mod_savepoint(true, 2012061701, 'scorm');
}
// Moodle v2.4.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2015101301) {
// Define table scorm_scoes_item to be created.
$table = new xmldb_table('scorm_scoes_item');
// Adding fields to table scorm_scoes_item.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('scorm_scoes_track_id', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
$table->add_field('field_id', XMLDB_TYPE_CHAR, '255', null, null, null, null);
$table->add_field('field_text', XMLDB_TYPE_CHAR, '255', null, null, null, null);
$table->add_field('field_value', XMLDB_TYPE_CHAR, '255', null, null, null, null);
// Adding keys to table scorm_scoes_item.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
// Conditionally launch create table for scorm_scoes_item.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Scorm savepoint reached.
upgrade_mod_savepoint(true, 2015101301, 'scorm');
}
return true;
}
开发者ID:Healthcare-Learning,项目名称:TCAPI-Moodle-SCORM-mod,代码行数:64,代码来源:upgrade.php
示例16: xmldb_block_search_upgrade
function xmldb_block_search_upgrade($oldversion)
{
global $CFG, $DB;
require 'upgradelib.php';
$result = TRUE;
$dbman = $DB->get_manager();
if ($oldversion < 2010101800) {
// See MDL-24374
// Changing type of field docdate on table block_search_documents to int
// Changing type of field updated on table block_search_documents to int
$table = new xmldb_table('block_search_documents');
$field_docdate_new = new xmldb_field('docdate_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'docdate');
$field_updated_new = new xmldb_field('updated_new', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'updated');
$field_docdate_old = new xmldb_field('docdate');
$field_updated_old = new xmldb_field('updated');
// Conditionally launch add temporary fields
if (!$dbman->field_exists($table, $field_docdate_new)) {
$dbman->add_field($table, $field_docdate_new);
}
if (!$dbman->field_exists($table, $field_updated_new)) {
$dbman->add_field($table, $field_updated_new);
}
$sql = "SELECT id, docdate, updated FROM {block_search_documents}";
$search_documents = $DB->get_records_sql($sql);
if ($search_documents) {
foreach ($search_documents as $sd) {
$sd->docdate_new = convert_datetime_upgrade($sd->docdate);
$sd->updated_new = convert_datetime_upgrade($sd->updated);
$DB->update_record('block_search_documents', $sd);
}
}
// Conditionally launch drop the old fields
if ($dbman->field_exists($table, $field_docdate_old)) {
$dbman->drop_field($table, $field_docdate_old);
}
if ($dbman->field_exists($table, $field_updated_old)) {
$dbman->drop_field($table, $field_updated_old);
}
//rename the new fields to the original field names.
$dbman->rename_field($table, $field_docdate_new, 'docdate');
$dbman->rename_field($table, $field_updated_new, 'updated');
// search savepoint reached
upgrade_block_savepoint(true, 2010101800, 'search');
}
if ($oldversion < 2010110900) {
unset_config('block_search_text');
unset_config('block_search_button');
upgrade_block_savepoint(true, 2010110900, 'search');
}
if ($oldversion < 2010111100) {
// set block to hidden if global search is disabled.
if ($CFG->enableglobalsearch != 1) {
$DB->set_field('block', 'visible', 0, array('name' => 'search'));
// Hide block
}
upgrade_block_savepoint(true, 2010111100, 'search');
}
return $result;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:59,代码来源:upgrade.php
示例17: xmldb_local_onlinejudge_uninstall
/**
* uninstall online judge
*
* @package local_onlinejudge
* @copyright 2011 Sun Zhigang (http://sunner.cn)
* @author Sun Zhigang
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_local_onlinejudge_uninstall()
{
unset_config('maxmemlimit', 'local_onlinejudge');
unset_config('maxcpulimit', 'local_onlinejudge');
unset_config('ideonedelay', 'local_onlinejudge');
$fs = get_file_storage();
return $fs->delete_area_files(get_context_instance(CONTEXT_SYSTEM)->id, 'local_onlinejudge');
}
开发者ID:boychunli,项目名称:moodle-local_onlinejudge,代码行数:16,代码来源:uninstall.php
示例18: question_remove_rqp_qtype_config_string
function question_remove_rqp_qtype_config_string()
{
global $CFG;
$result = true;
// An earlier, buggy version of the previous function missed out the unset_config call.
if (!empty($CFG->qtype_rqp_version) && !is_dir($CFG->dirroot . '/question/type/rqp')) {
$result = $result && unset_config('qtype_rqp_version');
}
return $result;
}
开发者ID:r007,项目名称:PMoodle,代码行数:10,代码来源:upgrade.php
示例19: xmldb_local_sandbox_upgrade
/**
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_local_sandbox_upgrade($oldversion)
{
if ($oldversion < 2014051200) {
echo html_writer::tag('div', get_string('upgrade_notice_2014051200', 'local_sandbox'), array('class' => 'alert alert-info'));
unset_config('cronruntimehour', 'local_sandbox');
unset_config('cronruntimemin', 'local_sandbox');
unset_config('cronrunday', 'local_sandbox');
upgrade_plugin_savepoint(true, 2014051200, 'local', 'sandbox');
}
return true;
}
开发者ID:andrewhancox,项目名称:moodle-local_sandbox,代码行数:15,代码来源:upgrade.php
示例20: xmldb_editor_tinymce_upgrade
function xmldb_editor_tinymce_upgrade($oldversion)
{
global $CFG, $DB;
$dbman = $DB->get_manager();
if ($oldversion < 2012083100) {
// Reset redesigned editor toolbar setting.
unset_config('customtoolbar', 'editor_tinymce');
upgrade_plugin_savepoint(true, 2012083100, 'editor', 'tinymce');
}
return true;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:11,代码来源:upgrade.php
注:本文中的unset_config函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论