本文整理汇总了PHP中upgrade_save_orphaned_questions函数的典型用法代码示例。如果您正苦于以下问题:PHP upgrade_save_orphaned_questions函数的具体用法?PHP upgrade_save_orphaned_questions怎么用?PHP upgrade_save_orphaned_questions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upgrade_save_orphaned_questions函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_main_upgrade
//.........这里部分代码省略.........
// Drop unused table "course_completion_notify"
$table = new xmldb_table('course_completion_notify');
// Conditionally launch drop table course_completion_notify
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.08);
}
if ($oldversion < 2012070600.09) {
// Define index path (not unique) to be added to context
$table = new xmldb_table('context');
$index = new xmldb_index('path', XMLDB_INDEX_NOTUNIQUE, array('path'), array('varchar_pattern_ops'));
// Recreate index with new pattern hint
if ($DB->get_dbfamily() === 'postgres') {
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.09);
}
if ($oldversion < 2012070600.1) {
// Define index name (unique) to be dropped form role
$table = new xmldb_table('role');
$index = new xmldb_index('name', XMLDB_INDEX_UNIQUE, array('name'));
// Conditionally launch drop index name
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.1);
}
if ($oldversion < 2012070600.11) {
// Define index component-itemid-userid (not unique) to be added to role_assignments
$table = new xmldb_table('role_assignments');
$index = new xmldb_index('component-itemid-userid', XMLDB_INDEX_NOTUNIQUE, array('component', 'itemid', 'userid'));
// Conditionally launch add index component-itemid-userid
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.11);
}
if ($oldversion < 2012071900.01) {
// Cleanup after simpeltests tool
capabilities_cleanup('tool_unittest');
unset_all_config_for_plugin('tool_unittest');
upgrade_main_savepoint(true, 2012071900.01);
}
if ($oldversion < 2012072400.0) {
// Remove obsolete xhtml strict setting - use THEME->doctype in theme config if necessary,
// see theme_config->doctype in lib/outputlib.php for more details.
unset_config('xmlstrictheaders');
upgrade_main_savepoint(true, 2012072400.0);
}
if ($oldversion < 2012072401.0) {
// Saves orphaned questions from the Dark Side
upgrade_save_orphaned_questions();
// Main savepoint reached
upgrade_main_savepoint(true, 2012072401.0);
}
if ($oldversion < 2012072600.01) {
// Handle events with empty eventtype //MDL-32827
$DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
$DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
$DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
$DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
$DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
// Main savepoint reached
upgrade_main_savepoint(true, 2012072600.01);
}
if ($oldversion < 2012080200.02) {
// Drop obsolete question upgrade field that should have been added to the install.xml.
$table = new xmldb_table('question');
$field = new xmldb_field('oldquestiontextformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
upgrade_main_savepoint(true, 2012080200.02);
}
if ($oldversion < 2012081400.01) {
// Move the ability to disable blogs to its own setting MDL-25012.
if (isset($CFG->bloglevel)) {
// Only change settings if existing setting was set.
if (empty($CFG->bloglevel)) {
set_config('enableblogs', 0);
// Now set the bloglevel to a valid setting as the disabled setting has been removed.
// This prevents confusing results when users enable the blog system in future.
set_config('bloglevel', BLOG_USER_LEVEL);
} else {
set_config('enableblogs', 1);
}
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012081400.01);
}
return true;
}
示例2: xmldb_main_upgrade
//.........这里部分代码省略.........
$index = new xmldb_index('name', XMLDB_INDEX_UNIQUE, array('name'));
// Conditionally launch drop index name
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.1);
}
if ($oldversion < 2012070600.11) {
// Define index component-itemid-userid (not unique) to be added to role_assignments
$table = new xmldb_table('role_assignments');
$index = new xmldb_index('component-itemid-userid', XMLDB_INDEX_NOTUNIQUE, array('component', 'itemid', 'userid'));
// Conditionally launch add index component-itemid-userid
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.11);
}
if ($oldversion < 2012071900.01) {
// Cleanup after simpeltests tool
capabilities_cleanup('tool_unittest');
unset_all_config_for_plugin('tool_unittest');
upgrade_main_savepoint(true, 2012071900.01);
}
if ($oldversion < 2012072400.0) {
// Remove obsolete xhtml strict setting - use THEME->doctype in theme config if necessary,
// see theme_config->doctype in lib/outputlib.php for more details.
unset_config('xmlstrictheaders');
upgrade_main_savepoint(true, 2012072400.0);
}
if ($oldversion < 2012072401.0) {
// Saves orphaned questions from the Dark Side
upgrade_save_orphaned_questions();
// Main savepoint reached
upgrade_main_savepoint(true, 2012072401.0);
}
if ($oldversion < 2012072600.01) {
// Handle events with empty eventtype //MDL-32827
$DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
$DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
$DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
$DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
$DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
// Main savepoint reached
upgrade_main_savepoint(true, 2012072600.01);
}
if ($oldversion < 2012080200.02) {
// Drop obsolete question upgrade field that should have been added to the install.xml.
$table = new xmldb_table('question');
$field = new xmldb_field('oldquestiontextformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
upgrade_main_savepoint(true, 2012080200.02);
}
if ($oldversion < 2012081400.01) {
// Move the ability to disable blogs to its own setting MDL-25012.
if (isset($CFG->bloglevel)) {
// Only change settings if existing setting was set.
if (empty($CFG->bloglevel)) {
set_config('enableblogs', 0);
// Now set the bloglevel to a valid setting as the disabled setting has been removed.
// This prevents confusing results when users enable the blog system in future.
set_config('bloglevel', BLOG_USER_LEVEL);
} else {
示例3: xmldb_main_upgrade
//.........这里部分代码省略.........
$index = new xmldb_index('name', XMLDB_INDEX_UNIQUE, array('name'));
// Conditionally launch drop index name
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.1);
}
if ($oldversion < 2012070600.11) {
// Define index component-itemid-userid (not unique) to be added to role_assignments
$table = new xmldb_table('role_assignments');
$index = new xmldb_index('component-itemid-userid', XMLDB_INDEX_NOTUNIQUE, array('component', 'itemid', 'userid'));
// Conditionally launch add index component-itemid-userid
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012070600.11);
}
if ($oldversion < 2012071900.01) {
// Cleanup after simpeltests tool
capabilities_cleanup('tool_unittest');
unset_all_config_for_plugin('tool_unittest');
upgrade_main_savepoint(true, 2012071900.01);
}
if ($oldversion < 2012072400.0) {
// Remove obsolete xhtml strict setting - use THEME->doctype in theme config if necessary,
// see theme_config->doctype in lib/outputlib.php for more details.
unset_config('xmlstrictheaders');
upgrade_main_savepoint(true, 2012072400.0);
}
if ($oldversion < 2012072401.0) {
// Saves orphaned questions from the Dark Side
upgrade_save_orphaned_questions();
// Main savepoint reached
upgrade_main_savepoint(true, 2012072401.0);
}
if ($oldversion < 2012072600.01) {
// Handle events with empty eventtype //MDL-32827
$DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
$DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
$DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
$DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
$DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
// Main savepoint reached
upgrade_main_savepoint(true, 2012072600.01);
}
if ($oldversion < 2012080200.02) {
// Drop obsolete question upgrade field that should have been added to the install.xml.
$table = new xmldb_table('question');
$field = new xmldb_field('oldquestiontextformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
upgrade_main_savepoint(true, 2012080200.02);
}
if ($oldversion < 2012081400.01) {
// Move the ability to disable blogs to its own setting MDL-25012.
if (isset($CFG->bloglevel)) {
// Only change settings if existing setting was set.
if (empty($CFG->bloglevel)) {
set_config('enableblogs', 0);
// Now set the bloglevel to a valid setting as the disabled setting has been removed.
// This prevents confusing results when users enable the blog system in future.
set_config('bloglevel', BLOG_USER_LEVEL);
} else {
示例4: xmldb_main_upgrade
//.........这里部分代码省略.........
$dbman->drop_table($table);
}
// Define table backup_ids to be dropped
$table = new xmldb_table('backup_ids');
// Conditionally launch drop table for backup_ids
if ($dbman->table_exists($table)) {
$dbman->drop_table($table);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012062500.02);
}
if ($oldversion < 2012062501.01) {
// Define index component-itemid-userid (not unique) to be added to role_assignments
$table = new xmldb_table('role_assignments');
$index = new xmldb_index('component-itemid-userid', XMLDB_INDEX_NOTUNIQUE, array('component', 'itemid', 'userid'));
// Conditionally launch add index component-itemid-userid
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached
upgrade_main_savepoint(true, 2012062501.01);
}
if ($oldversion < 2012062501.04) {
// Saves orphaned questions from the Dark Side
upgrade_save_orphaned_questions();
// Main savepoint reached
upgrade_main_savepoint(true, 2012062501.04);
}
if ($oldversion < 2012062501.06) {
// Handle events with empty eventtype MDL-32827
$DB->set_field('event', 'eventtype', 'site', array('eventtype' => '', 'courseid' => $SITE->id));
$DB->set_field_select('event', 'eventtype', 'due', "eventtype = '' AND courseid != 0 AND groupid = 0 AND (modulename = 'assignment' OR modulename = 'assign')");
$DB->set_field_select('event', 'eventtype', 'course', "eventtype = '' AND courseid != 0 AND groupid = 0");
$DB->set_field_select('event', 'eventtype', 'group', "eventtype = '' AND groupid != 0");
$DB->set_field_select('event', 'eventtype', 'user', "eventtype = '' AND userid != 0");
// Main savepoint reached
upgrade_main_savepoint(true, 2012062501.06);
}
if ($oldversion < 2012062501.08) {
// Drop obsolete question upgrade field that should have been added to the install.xml.
$table = new xmldb_table('question');
$field = new xmldb_field('oldquestiontextformat', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0');
if ($dbman->field_exists($table, $field)) {
$dbman->drop_field($table, $field);
}
upgrade_main_savepoint(true, 2012062501.08);
}
if ($oldversion < 2012062501.14) {