本文整理汇总了PHP中upgrade_fix_missing_root_folders函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_fix_missing_root_folders函数的具体用法?PHP upgrade_fix_missing_root_folders怎么用?PHP upgrade_fix_missing_root_folders使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_fix_missing_root_folders函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xmldb_main_upgrade
//.........这里部分代码省略.........
$params = array('plugin' => 'editor_atto', 'name' => 'version');
$attoversion = $DB->get_record('config_plugins', $params, 'value', IGNORE_MISSING);
if ($attoversion) {
$attoversion = floatval($attoversion->value);
}
// Only these versions that were part of 2.6 beta should be removed.
// Manually installed versions of 2.5 - or later releases for 2.6 installed
// via the plugins DB should not be uninstalled.
if ($attoversion && $attoversion > 2013051500.0 && $attoversion < 2013102201.0) {
// Remove all other associated config.
unset_all_config_for_plugin('editor_atto');
unset_all_config_for_plugin('atto_bold');
unset_all_config_for_plugin('atto_clear');
unset_all_config_for_plugin('atto_html');
unset_all_config_for_plugin('atto_image');
unset_all_config_for_plugin('atto_indent');
unset_all_config_for_plugin('atto_italic');
unset_all_config_for_plugin('atto_link');
unset_all_config_for_plugin('atto_media');
unset_all_config_for_plugin('atto_orderedlist');
unset_all_config_for_plugin('atto_outdent');
unset_all_config_for_plugin('atto_strike');
unset_all_config_for_plugin('atto_title');
unset_all_config_for_plugin('atto_underline');
unset_all_config_for_plugin('atto_unlink');
unset_all_config_for_plugin('atto_unorderedlist');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013102201.0);
}
if ($oldversion < 2013102500.01) {
// Find all fileareas that have missing root folder entry and add the root folder entry.
if (empty($CFG->filesrootrecordsfixed)) {
upgrade_fix_missing_root_folders();
// To skip running the same script on the upgrade to the next major release.
set_config('filesrootrecordsfixed', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013102500.01);
}
if ($oldversion < 2013110500.01) {
// MDL-38228. Corrected course_modules upgrade script instead of 2013021801.01.
// This upgrade script fixes the mismatches between DB fields course_modules.section
// and course_sections.sequence. It makes sure that each module is included
// in the sequence of at least one section.
// There is also a separate script for admins: admin/cli/fix_course_sortorder.php
// This script in included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->movingmoduleupgradescriptwasrun)) {
upgrade_course_modules_sequences();
// To skip running the same script on the upgrade to the next major release.
set_config('movingmoduleupgradescriptwasrun', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013110500.01);
}
if ($oldversion < 2013110600.01) {
if (!file_exists($CFG->dirroot . '/theme/mymobile')) {
// Replace the mymobile settings.
$DB->set_field('course', 'theme', 'clean', array('theme' => 'mymobile'));
$DB->set_field('course_categories', 'theme', 'clean', array('theme' => 'mymobile'));
$DB->set_field('user', 'theme', 'clean', array('theme' => 'mymobile'));
$DB->set_field('mnet_host', 'theme', 'clean', array('theme' => 'mymobile'));
// Replace the theme configs.
if (get_config('core', 'theme') === 'mymobile') {
set_config('theme', 'clean');
}
开发者ID:HuiChangZhai,项目名称:moodle,代码行数:67,代码来源:upgrade.php
示例2: test_upgrade_fix_missing_root_folders
public function test_upgrade_fix_missing_root_folders()
{
global $DB, $SITE;
$this->resetAfterTest(true);
// Setup some broken data...
// Create two resources (and associated file areas).
$this->setAdminUser();
$resource1 = $this->getDataGenerator()->get_plugin_generator('mod_resource')->create_instance(array('course' => $SITE->id));
$resource2 = $this->getDataGenerator()->get_plugin_generator('mod_resource')->create_instance(array('course' => $SITE->id));
// Delete the folder record of resource1 to simulate broken data.
$context = context_module::instance($resource1->cmid);
$selectargs = array('contextid' => $context->id, 'component' => 'mod_resource', 'filearea' => 'content', 'itemid' => 0);
// Verify file records exist.
$areafilecount = $DB->count_records('files', $selectargs);
$this->assertNotEmpty($areafilecount);
// Delete the folder record.
$folderrecord = $selectargs;
$folderrecord['filepath'] = '/';
$folderrecord['filename'] = '.';
// Get previous folder record.
$oldrecord = $DB->get_record('files', $folderrecord);
$DB->delete_records('files', $folderrecord);
// Verify the folder record has been removed.
$newareafilecount = $DB->count_records('files', $selectargs);
$this->assertSame($newareafilecount, $areafilecount - 1);
$this->assertFalse($DB->record_exists('files', $folderrecord));
// Run the upgrade step!
upgrade_fix_missing_root_folders();
// Verify the folder record has been restored.
$newareafilecount = $DB->count_records('files', $selectargs);
$this->assertSame($newareafilecount, $areafilecount);
$newrecord = $DB->get_record('files', $folderrecord, '*', MUST_EXIST);
// Verify the hash is correctly created.
$this->assertSame($oldrecord->pathnamehash, $newrecord->pathnamehash);
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:35,代码来源:upgradelib_test.php
示例3: xmldb_main_upgrade
//.........这里部分代码省略.........
$sql = "UPDATE {license}\n SET source = :url, version = :newversion\n WHERE shortname = :shortname AND version = :oldversion";
$params = array('url' => 'http://creativecommons.org/licenses/by-nc/3.0/', 'shortname' => 'cc-nc', 'newversion' => '2013051500', 'oldversion' => '2010033100');
$DB->execute($sql, $params);
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051400.01);
}
if ($oldversion < 2013051400.06) {
// Clean up old tokens which haven't been deleted.
$DB->execute("DELETE FROM {user_private_key} WHERE NOT EXISTS\n (SELECT 'x' FROM {user} WHERE deleted = 0 AND id = userid)");
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051400.06);
}
if ($oldversion < 2013051401.01) {
// Remove orphan repository instances.
if ($DB->get_dbfamily() === 'mysql') {
$sql = "DELETE {repository_instances} FROM {repository_instances}\n LEFT JOIN {context} ON {context}.id = {repository_instances}.contextid\n WHERE {context}.id IS NULL";
} else {
$sql = "DELETE FROM {repository_instances}\n WHERE NOT EXISTS (\n SELECT 'x' FROM {context}\n WHERE {context}.id = {repository_instances}.contextid)";
}
$DB->execute($sql);
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051401.01);
}
if ($oldversion < 2013051402.06) {
// Fixing possible wrong MIME type for Java Network Launch Protocol (JNLP) files.
$select = $DB->sql_like('filename', '?', false);
$DB->set_field_select('files', 'mimetype', 'application/x-java-jnlp-file', $select, array('%.jnlp'));
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051402.06);
}
if ($oldversion < 2013051402.1) {
// Find all fileareas that have missing root folder entry and add the root folder entry.
if (empty($CFG->filesrootrecordsfixed)) {
upgrade_fix_missing_root_folders();
// To skip running the same script on the upgrade to the next major release.
set_config('filesrootrecordsfixed', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051402.1);
}
if ($oldversion < 2013051402.12) {
// MDL-38228. Corrected course_modules upgrade script instead of 2013021801.01.
// This upgrade script fixes the mismatches between DB fields course_modules.section
// and course_sections.sequence. It makes sure that each module is included
// in the sequence of only one section and that course_modules.section points back to it.
// This script in included in each major version upgrade process so make sure we don't run it twice.
if (empty($CFG->movingmoduleupgradescriptwasrun)) {
upgrade_course_modules_sequences();
// To skip running the same script on the upgrade to the next major release.
set_config('movingmoduleupgradescriptwasrun', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051402.12);
}
if ($oldversion < 2013051403.02) {
// Delete notes of deleted courses.
$sql = "DELETE FROM {post}\n WHERE NOT EXISTS (SELECT {course}.id FROM {course}\n WHERE {course}.id = {post}.courseid)\n AND {post}.module = ?";
$DB->execute($sql, array('notes'));
// Main savepoint reached.
upgrade_main_savepoint(true, 2013051403.02);
}
if ($oldversion < 2013051403.09) {
// Purge stored passwords from config_log table, ideally this should be in each plugin
// but that would complicate backporting...
$items = array('core/cronremotepassword', 'core/proxypassword', 'core/smtppass', 'core/jabberpassword', 'enrol_database/dbpass', 'enrol_ldap/bind_pw', 'url/secretphrase');
foreach ($items as $item) {
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:67,代码来源:upgrade.php
注:本文中的upgrade_fix_missing_root_folders函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论