本文整理汇总了PHP中upgrade_fix_missing_root_folders_draft函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_fix_missing_root_folders_draft函数的具体用法?PHP upgrade_fix_missing_root_folders_draft怎么用?PHP upgrade_fix_missing_root_folders_draft使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_fix_missing_root_folders_draft函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: xmldb_main_upgrade
//.........这里部分代码省略.........
$blocks = array('course_overview', 'private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
list($blocksql, $blockparams) = $DB->get_in_or_equal($blocks, SQL_PARAMS_NAMED);
$select = "parentcontextid = :contextid\n AND pagetypepattern = :page\n AND showinsubcontexts = 0\n AND subpagepattern IS NULL\n AND blockname {$blocksql}";
$params = array('contextid' => context_system::instance()->id, 'page' => 'my-index');
$params = array_merge($params, $blockparams);
$DB->set_field_select('block_instances', 'subpagepattern', $systempage->id, $select, $params);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014101001.0);
}
if ($oldversion < 2014102000.0) {
// Define field aggregatesubcats to be dropped from grade_categories.
$table = new xmldb_table('grade_categories');
$field = new xmldb_field('aggregatesubcats');
// Conditionally launch drop field aggregatesubcats.
if ($dbman->field_exists($table, $field)) {
$sql = 'SELECT DISTINCT courseid
FROM {grade_categories}
WHERE aggregatesubcats = ?';
$courses = $DB->get_records_sql($sql, array(1));
foreach ($courses as $course) {
set_config('show_aggregatesubcats_upgrade_' . $course->courseid, 1);
// Set each of the grade items to needing an update so that when the user visits the grade reports the
// figures will be updated.
$DB->set_field('grade_items', 'needsupdate', 1, array('courseid' => $course->courseid));
}
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014102000.0);
}
if ($oldversion < 2014110300.0) {
// Run script restoring missing folder records for draft file areas.
upgrade_fix_missing_root_folders_draft();
// Main savepoint reached.
upgrade_main_savepoint(true, 2014110300.0);
}
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2014111000.0) {
// Coming from 2.7 or older, we need to flag the step minmaxgrade to be ignored.
set_config('upgrade_minmaxgradestepignored', 1);
// Coming from 2.7 or older, we need to flag the step for changing calculated grades to be regraded.
set_config('upgrade_calculatedgradeitemsonlyregrade', 1);
// Main savepoint reached.
upgrade_main_savepoint(true, 2014111000.0);
}
if ($oldversion < 2014120100.0) {
// Define field sslverification to be added to mnet_host.
$table = new xmldb_table('mnet_host');
$field = new xmldb_field('sslverification', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'applicationid');
// Conditionally launch add field sslverification.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014120100.0);
}
if ($oldversion < 2014120101.0) {
// Define field component to be added to comments.
$table = new xmldb_table('comments');
$field = new xmldb_field('component', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'contextid');
// Conditionally launch add field component.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
开发者ID:isuruAb,项目名称:moodle,代码行数:67,代码来源:upgrade.php
示例2: xmldb_main_upgrade
//.........这里部分代码省略.........
set_config('grades_sumofgrades_upgrade_flagged', 1);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100600.04);
}
if ($oldversion < 2014100700.0) {
// Define table messageinbound_messagelist to be created.
$table = new xmldb_table('messageinbound_messagelist');
// Adding fields to table messageinbound_messagelist.
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
$table->add_field('messageid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
$table->add_field('address', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
// Adding keys to table messageinbound_messagelist.
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
$table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
// Conditionally launch create table for messageinbound_messagelist.
if (!$dbman->table_exists($table)) {
$dbman->create_table($table);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100700.0);
}
if ($oldversion < 2014100700.01) {
// Define field visible to be added to cohort.
$table = new xmldb_table('cohort');
$field = new xmldb_field('visible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'descriptionformat');
// Conditionally launch add field visible.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100700.01);
}
if ($oldversion < 2014100800.0) {
// Remove qformat_learnwise (unless it has manually been added back).
if (!file_exists($CFG->dirroot . '/question/format/learnwise/format.php')) {
unset_all_config_for_plugin('qformat_learnwise');
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014100800.0);
}
if ($oldversion < 2014101001.0) {
// Some blocks added themselves to the my/ home page, but they did not declare the
// subpage of the default my home page. While the upgrade script has been fixed, this
// upgrade script will fix the data that was wrongly added.
// We only proceed if we can find the right entry from my_pages. Private => 1 refers to
// the constant value MY_PAGE_PRIVATE.
if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
// Select the blocks there could have been automatically added. showinsubcontexts is hardcoded to 0
// because it is possible for administrators to have forced it on the my/ page by adding it to the
// system directly rather than updating the default my/ page.
$blocks = array('course_overview', 'private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
list($blocksql, $blockparams) = $DB->get_in_or_equal($blocks, SQL_PARAMS_NAMED);
$select = "parentcontextid = :contextid\n AND pagetypepattern = :page\n AND showinsubcontexts = 0\n AND subpagepattern IS NULL\n AND blockname {$blocksql}";
$params = array('contextid' => context_system::instance()->id, 'page' => 'my-index');
$params = array_merge($params, $blockparams);
$DB->set_field_select('block_instances', 'subpagepattern', $systempage->id, $select, $params);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014101001.0);
}
if ($oldversion < 2014102000.0) {
// Define field aggregatesubcats to be dropped from grade_categories.
$table = new xmldb_table('grade_categories');
$field = new xmldb_field('aggregatesubcats');
// Conditionally launch drop field aggregatesubcats.
if ($dbman->field_exists($table, $field)) {
$sql = 'SELECT DISTINCT courseid
FROM {grade_categories}
WHERE aggregatesubcats = ?';
$courses = $DB->get_records_sql($sql, array(1));
foreach ($courses as $course) {
set_config('show_aggregatesubcats_upgrade_' . $course->courseid, 1);
// Set each of the grade items to needing an update so that when the user visits the grade reports the
// figures will be updated.
$DB->set_field('grade_items', 'needsupdate', 1, array('courseid' => $course->courseid));
}
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014102000.0);
}
if ($oldversion < 2014110300.0) {
// Run script restoring missing folder records for draft file areas.
upgrade_fix_missing_root_folders_draft();
// Main savepoint reached.
upgrade_main_savepoint(true, 2014110300.0);
}
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2014111002.01) {
// Make sure the private files handler is not set to expire.
$DB->set_field('messageinbound_handlers', 'defaultexpiration', 0, array('classname' => '\\core\\message\\inbound\\private_files_handler'));
// Main savepoint reached.
upgrade_main_savepoint(true, 2014111002.01);
}
return true;
}
开发者ID:adonm,项目名称:learning,代码行数:101,代码来源:upgrade.php
示例3: test_upgrade_fix_missing_root_folders_draft
public function test_upgrade_fix_missing_root_folders_draft()
{
global $DB, $SITE;
$this->resetAfterTest(true);
$user = $this->getDataGenerator()->create_user();
$usercontext = context_user::instance($user->id);
$this->setUser($user);
$resource1 = $this->getDataGenerator()->get_plugin_generator('mod_resource')->create_instance(array('course' => $SITE->id));
$context = context_module::instance($resource1->cmid);
$draftitemid = 0;
file_prepare_draft_area($draftitemid, $context->id, 'mod_resource', 'content', 0);
$queryparams = array('component' => 'user', 'contextid' => $usercontext->id, 'filearea' => 'draft', 'itemid' => $draftitemid);
// Make sure there are two records in files for the draft file area and one of them has filename '.'.
$records = $DB->get_records_menu('files', $queryparams, '', 'id, filename');
$this->assertEquals(2, count($records));
$this->assertTrue(in_array('.', $records));
$originalhash = $DB->get_field('files', 'pathnamehash', $queryparams + array('filename' => '.'));
// Delete record with filename '.' and make sure it does not exist any more.
$DB->delete_records('files', $queryparams + array('filename' => '.'));
$records = $DB->get_records_menu('files', $queryparams, '', 'id, filename');
$this->assertEquals(1, count($records));
$this->assertFalse(in_array('.', $records));
// Run upgrade script and make sure the record is restored.
upgrade_fix_missing_root_folders_draft();
$records = $DB->get_records_menu('files', $queryparams, '', 'id, filename');
$this->assertEquals(2, count($records));
$this->assertTrue(in_array('.', $records));
$newhash = $DB->get_field('files', 'pathnamehash', $queryparams + array('filename' => '.'));
$this->assertEquals($originalhash, $newhash);
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:30,代码来源:upgradelib_test.php
示例4: xmldb_main_upgrade
//.........这里部分代码省略.........
$blocks = array('course_overview', 'private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
list($blocksql, $blockparams) = $DB->get_in_or_equal($blocks, SQL_PARAMS_NAMED);
$select = "parentcontextid = :contextid\n AND pagetypepattern = :page\n AND showinsubcontexts = 0\n AND subpagepattern IS NULL\n AND blockname {$blocksql}";
$params = array('contextid' => context_system::instance()->id, 'page' => 'my-index');
$params = array_merge($params, $blockparams);
$DB->set_field_select('block_instances', 'subpagepattern', $systempage->id, $select, $params);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014101001.0);
}
if ($oldversion < 2014102000.0) {
// Define field aggregatesubcats to be dropped from grade_categories.
$table = new xmldb_table('grade_categories');
$field = new xmldb_field('aggregatesubcats');
// Conditionally launch drop field aggregatesubcats.
if ($dbman->field_exists($table, $field)) {
$sql = 'SELECT DISTINCT courseid
FROM {grade_categories}
WHERE aggregatesubcats = ?';
$courses = $DB->get_records_sql($sql, array(1));
foreach ($courses as $course) {
set_config('show_aggregatesubcats_upgrade_' . $course->courseid, 1);
// Set each of the grade items to needing an update so that when the user visits the grade reports the
// figures will be updated.
$DB->set_field('grade_items', 'needsupdate', 1, array('courseid' => $course->courseid));
}
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014102000.0);
}
if ($oldversion < 2014110300.0) {
// Run script restoring missing folder records for draft file areas.
upgrade_fix_missing_root_folders_draft();
// Main savepoint reached.
upgrade_main_savepoint(true, 2014110300.0);
}
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2014111000.0) {
// Coming from 2.7 or older, we need to flag the step minmaxgrade to be ignored.
set_config('upgrade_minmaxgradestepignored', 1);
// Coming from 2.7 or older, we need to flag the step for changing calculated grades to be regraded.
set_config('upgrade_calculatedgradeitemsonlyregrade', 1);
// Main savepoint reached.
upgrade_main_savepoint(true, 2014111000.0);
}
if ($oldversion < 2014120100.0) {
// Define field sslverification to be added to mnet_host.
$table = new xmldb_table('mnet_host');
$field = new xmldb_field('sslverification', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'applicationid');
// Conditionally launch add field sslverification.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2014120100.0);
}
if ($oldversion < 2014120101.0) {
// Define field component to be added to comments.
$table = new xmldb_table('comments');
$field = new xmldb_field('component', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'contextid');
// Conditionally launch add field component.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:67,代码来源:upgrade.php
注:本文中的upgrade_fix_missing_root_folders_draft函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论