当前位置: 首页>>代码示例>>PHP>>正文


PHP backup_controller_dbops::create_backup_ids_temp_table方法代码示例

本文整理汇总了PHP中backup_controller_dbops::create_backup_ids_temp_table方法的典型用法代码示例。如果您正苦于以下问题:PHP backup_controller_dbops::create_backup_ids_temp_table方法的具体用法?PHP backup_controller_dbops::create_backup_ids_temp_table怎么用?PHP backup_controller_dbops::create_backup_ids_temp_table使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在backup_controller_dbops的用法示例。


在下文中一共展示了backup_controller_dbops::create_backup_ids_temp_table方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: define_execution

 protected function define_execution() {
     $progress = $this->task->get_progress();
     $progress->start_progress('Deleting backup directories');
     backup_helper::check_and_create_backup_dir($this->get_backupid());// Create backup temp dir
     backup_helper::clear_backup_dir($this->get_backupid(), $progress);           // Empty temp dir, just in case
     backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid()); // Drop ids temp table
     backup_controller_dbops::create_backup_ids_temp_table($this->get_backupid()); // Create ids temp table
     $progress->end_progress();
 }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:9,代码来源:backup_stepslib.php

示例2: define_execution

 protected function define_execution()
 {
     backup_helper::check_and_create_backup_dir($this->get_backupid());
     // Create backup temp dir
     backup_helper::clear_backup_dir($this->get_backupid());
     // Empty temp dir, just in case
     backup_helper::delete_old_backup_dirs(time() - 4 * 60 * 60);
     // Delete > 4 hours temp dirs
     backup_controller_dbops::create_backup_ids_temp_table($this->get_backupid());
     // Create ids temp table
 }
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:11,代码来源:backup_stepslib.php

示例3: create_stash_storage

 /**
  * Creates the temporary storage for stashed data
  *
  * This implementation uses backup_ids_temp table.
  */
 public function create_stash_storage() {
     backup_controller_dbops::create_backup_ids_temp_table($this->get_id());
 }
开发者ID:ncsu-delta,项目名称:moodle,代码行数:8,代码来源:lib.php

示例4: test_backup_controller_dbops

 function test_backup_controller_dbops()
 {
     global $DB;
     $dbman = $DB->get_manager();
     // Going to use some database_manager services for testing
     // Instantiate non interactive backup_controller
     $bc = new mock_backup_controller4dbops(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
     $this->assertTrue($bc instanceof backup_controller);
     // Calculate checksum
     $checksum = $bc->calculate_checksum();
     $this->assertEqual(strlen($checksum), 32);
     // is one md5
     // save controller
     $recid = backup_controller_dbops::save_controller($bc, $checksum);
     $this->assertTrue($recid);
     $this->todelete[] = array('backup_controllers', $recid);
     // mark this record for deletion
     // save it again (should cause update to happen)
     $recid2 = backup_controller_dbops::save_controller($bc, $checksum);
     $this->assertTrue($recid2);
     $this->todelete[] = array('backup_controllers', $recid2);
     // mark this record for deletion
     $this->assertEqual($recid, $recid2);
     // Same record in both save operations
     // Try incorrect checksum
     $bc = new mock_backup_controller4dbops(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
     $checksum = $bc->calculate_checksum();
     try {
         $recid = backup_controller_dbops::save_controller($bc, 'lalala');
         $this->assertTrue(false, 'backup_dbops_exception expected');
     } catch (exception $e) {
         $this->assertTrue($e instanceof backup_dbops_exception);
         $this->assertEqual($e->errorcode, 'backup_controller_dbops_saving_checksum_mismatch');
     }
     // Try to save non backup_controller object
     $bc = new stdclass();
     try {
         $recid = backup_controller_dbops::save_controller($bc, 'lalala');
         $this->assertTrue(false, 'backup_controller_exception expected');
     } catch (exception $e) {
         $this->assertTrue($e instanceof backup_controller_exception);
         $this->assertEqual($e->errorcode, 'backup_controller_expected');
     }
     // save and load controller (by backupid). Then compare
     $bc = new mock_backup_controller4dbops(backup::TYPE_1ACTIVITY, $this->moduleid, backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_GENERAL, $this->userid);
     $checksum = $bc->calculate_checksum();
     // Calculate checksum
     $backupid = $bc->get_backupid();
     $this->assertEqual(strlen($backupid), 32);
     // is one md5
     $recid = backup_controller_dbops::save_controller($bc, $checksum);
     // save controller
     $this->todelete[] = array('backup_controllers', $recid);
     // mark this record for deletion
     $newbc = backup_controller_dbops::load_controller($backupid);
     // load controller
     $this->assertTrue($newbc instanceof backup_controller);
     $newchecksum = $newbc->calculate_checksum();
     $this->assertEqual($newchecksum, $checksum);
     // try to load non-existing controller
     try {
         $bc = backup_controller_dbops::load_controller('1234567890');
         $this->assertTrue(false, 'backup_dbops_exception expected');
     } catch (exception $e) {
         $this->assertTrue($e instanceof backup_dbops_exception);
         $this->assertEqual($e->errorcode, 'backup_controller_dbops_nonexisting');
     }
     // backup_ids_temp table tests
     // If, for any reason table exists, drop it
     if ($dbman->table_exists('backup_ids_temp')) {
         $dbman->drop_temp_table(new xmldb_table('backup_ids_temp'));
     }
     // Check backup_ids_temp table doesn't exist
     $this->assertFalse($dbman->table_exists('backup_ids_temp'));
     // Create and check it exists
     backup_controller_dbops::create_backup_ids_temp_table('testingid');
     $this->assertTrue($dbman->table_exists('backup_ids_temp'));
     // Drop and check it doesn't exists anymore
     backup_controller_dbops::drop_backup_ids_temp_table('testingid');
     $this->assertFalse($dbman->table_exists('backup_ids_temp'));
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:81,代码来源:testdbops.php

示例5: create_restore_temp_tables

 public static function create_restore_temp_tables($restoreid)
 {
     global $CFG, $DB;
     $dbman = $DB->get_manager();
     // We are going to use database_manager services
     if ($dbman->table_exists('backup_ids_temp')) {
         // Table exists, from restore prechecks
         // TODO: Improve this by inserting/selecting some record to see there is restoreid match
         // TODO: If not match, exception, table corresponds to another backup/restore operation
         return true;
     }
     backup_controller_dbops::create_backup_ids_temp_table($restoreid);
     backup_controller_dbops::create_backup_files_temp_table($restoreid);
     return false;
 }
开发者ID:gabrielrosset,项目名称:moodle,代码行数:15,代码来源:restore_controller_dbops.class.php

示例6: test_backup_structure_construct


//.........这里部分代码省略.........
     // 1 object array
     // Skip alternative2 source definition on purpose (will be tested)
     // $alternative2->set_source_array(array((object)array('name' => 'alternative2', 'value' => 2))); // 1 object array
     $alternative3->set_source_array(array((object) array('name' => 'alternative3', 'value' => 3)));
     // 1 object array
     // Alternative 4 source is the forum type and name, so we'll get that in ALL posts (no conditions) that
     // have not another alternative (post4 in our testing data in the only not matching any other alternative)
     $alternative4->set_source_sql('SELECT type AS forumtype, name AS forumname
                                      FROM {forum}
                                     WHERE id = ?', array('/forum/id'));
     // Set children of optigroup_element source
     $dupetest1->set_source_array(array((object) array('field1' => '1', 'field2' => 1)));
     // 1 object array
     $dupetest2->set_source_array(array((object) array('field1' => '2', 'field2' => 2)));
     // 1 object array
     $dupetest3->set_source_array(array((object) array('field1' => '3', 'field2' => 3)));
     // 1 object array
     $dupetest4->set_source_array(array((object) array('field1' => '4', 'field2' => 4)));
     // 1 object array
     // Define some aliases
     $rating->set_source_alias('rating', 'post_rating');
     // Map the 'rating' value from DB to 'post_rating' final element
     // Mark to detect files of type 'forum_intro' in forum (and not item id)
     $forum->annotate_files('mod_forum', 'intro', null);
     // Mark to detect file of type 'forum_post' and 'forum_attachment' in post (with itemid being post->id)
     $post->annotate_files('mod_forum', 'post', 'id');
     $post->annotate_files('mod_forum', 'attachment', 'id');
     // Mark various elements to be annotated
     $discussion->annotate_ids('user1', 'userid');
     $post->annotate_ids('forum_post', 'id');
     $rating->annotate_ids('user2', 'userid');
     $rating->annotate_ids('forum_post', 'itemid');
     // Create the backup_ids_temp table
     backup_controller_dbops::create_backup_ids_temp_table($backupid);
     // Instantiate in memory xml output
     $xo = new memory_xml_output();
     // Instantiate xml_writer and start it
     $xw = new xml_writer($xo);
     $xw->start();
     // Instantiate the backup processor
     $processor = new backup_structure_processor($xw);
     // Set some variables
     $processor->set_var(backup::VAR_ACTIVITYID, $this->forumid);
     $processor->set_var(backup::VAR_BACKUPID, $backupid);
     $processor->set_var(backup::VAR_CONTEXTID, $this->contextid);
     // Process the backup structure with the backup processor
     $forum->process($processor);
     // Stop the xml_writer
     $xw->stop();
     // Check various counters
     $this->assertEquals($forum->get_counter(), $DB->count_records('forum'));
     $this->assertEquals($discussion->get_counter(), $DB->count_records('forum_discussions'));
     $this->assertEquals($rating->get_counter(), $DB->count_records('rating'));
     $this->assertEquals($read->get_counter(), $DB->count_records('forum_read'));
     $this->assertEquals($inventeds->get_counter(), 2);
     // Array
     // Perform some validations with the generated XML
     $dom = new DomDocument();
     $dom->loadXML($xo->get_allcontents());
     $xpath = new DOMXPath($dom);
     // Some more counters
     $query = '/forum/discussions/discussion/posts/post';
     $posts = $xpath->query($query);
     $this->assertEquals($posts->length, $DB->count_records('forum_posts'));
     $query = '/forum/invented_elements/invented';
     $inventeds = $xpath->query($query);
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:67,代码来源:structure_test.php


注:本文中的backup_controller_dbops::create_backup_ids_temp_table方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。