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


PHP backup_controller_dbops::drop_backup_ids_temp_table方法代码示例

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


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

示例1: define_execution

 /**
  * Entry point for executing this step
  */
 protected function define_execution()
 {
     global $CFG;
     backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid());
     // Drop ids temp table
     //avoid purging old backup dirs to save on performance
     //avoid deleting the current backup dir because it's needed during the restore
     //delete the log file that was created
     $backupid = $this->get_backupid();
     unlink($CFG->dataroot . '/temp/backup/' . $backupid . '.log');
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:14,代码来源:stepslib.php

示例2: define_execution

    protected function define_execution() {
        global $CFG;

        backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid()); // Drop ids temp table
        backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));              // Delete > 4 hours temp dirs
        // Delete temp dir conditionally:
        // 1) If $CFG->keeptempdirectoriesonbackup is not enabled
        // 2) If backup temp dir deletion has been marked to be avoided
        if (empty($CFG->keeptempdirectoriesonbackup) && !$this->skipcleaningtempdir) {
            backup_helper::delete_backup_dir($this->get_backupid()); // Empty backup dir
        }
    }
开发者ID:nuckey,项目名称:moodle,代码行数:12,代码来源:backup_stepslib.php

示例3: define_execution

    protected function define_execution() {
        global $CFG;

        backup_controller_dbops::drop_backup_ids_temp_table($this->get_backupid()); // Drop ids temp table
        backup_helper::delete_old_backup_dirs(strtotime('-1 week'));                // Delete > 1 week old temp dirs.
        // Delete temp dir conditionally:
        // 1) If $CFG->keeptempdirectoriesonbackup is not enabled
        // 2) If backup temp dir deletion has been marked to be avoided
        if (empty($CFG->keeptempdirectoriesonbackup) && !$this->skipcleaningtempdir) {
            $progress = $this->task->get_progress();
            $progress->start_progress('Deleting backup dir');
            backup_helper::delete_backup_dir($this->get_backupid(), $progress); // Empty backup dir
            $progress->end_progress();
        }
    }
开发者ID:narasimhaeabyas,项目名称:tataaiapro,代码行数:15,代码来源:backup_stepslib.php

示例4: drop_stash_storage

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

示例5: 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

示例6: test_backup_structure_construct


//.........这里部分代码省略.........
         foreach ($rating->childNodes as $node) {
             if ($node->nodeType != XML_TEXT_NODE) {
                 $ratarr[$node->nodeName] = $node->nodeValue;
             }
         }
         $this->assertEquals($ratarr['userid'], $DB->get_field('rating', 'userid', array('id' => $ratarr['id'])));
         $this->assertEquals($ratarr['itemid'], $DB->get_field('rating', 'itemid', array('id' => $ratarr['id'])));
         $this->assertEquals($ratarr['post_rating'], $DB->get_field('rating', 'rating', array('id' => $ratarr['id'])));
     }
     // Check forum has "blockeperiod" with value 0 (was declared by object instead of name)
     $query = '/forum[blockperiod="0"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check forum is missing "completiondiscussions" (as we are using mock_skip_final_element)
     $query = '/forum/completiondiscussions';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     // Check forum has "completionreplies" with value "original was 0, now changed" (because of mock_modify_final_element)
     $query = '/forum[completionreplies="original was 0, now changed"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check forum has "completionposts" with value "intercepted!" (because of mock_final_element_interceptor)
     $query = '/forum[completionposts="intercepted!"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check there isn't any alternative2 tag, as far as it hasn't source defined
     $query = '//alternative2';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     // Check there are 4 "field1" elements
     $query = '/forum/discussions/discussion/posts/post//field1';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 4);
     // Check first post has one name element with value "alternative1"
     $query = '/forum/discussions/discussion/posts/post[@id="1"][name="alternative1"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check there are two "dupetest1" elements
     $query = '/forum/discussions/discussion/posts/post//dupetest1';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 2);
     // Check second post has one name element with value "dupetest2"
     $query = '/forum/discussions/discussion/posts/post[@id="2"]/dupetest2';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check element "dupetest2" of second post has one field1 element with value "2"
     $query = '/forum/discussions/discussion/posts/post[@id="2"]/dupetest2[field1="2"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check forth post has no name element
     $query = '/forum/discussions/discussion/posts/post[@id="4"]/name';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     // Check 1st, 2nd and 3rd posts have no forumtype element
     $query = '/forum/discussions/discussion/posts/post[@id="1"]/forumtype';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     $query = '/forum/discussions/discussion/posts/post[@id="2"]/forumtype';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     $query = '/forum/discussions/discussion/posts/post[@id="3"]/forumtype';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 0);
     // Check 4th post has one forumtype element with value "general"
     // (because it doesn't matches alternatives 1, 2, 3, then alternative 4,
     // the one without conditions is being applied)
     $query = '/forum/discussions/discussion/posts/post[@id="4"][forumtype="general"]';
     $result = $xpath->query($query);
     $this->assertEquals($result->length, 1);
     // Check annotations information against DB
     // Count records in original tables
     $c_postsid = $DB->count_records_sql('SELECT COUNT(DISTINCT id) FROM {forum_posts}');
     $c_dissuserid = $DB->count_records_sql('SELECT COUNT(DISTINCT userid) FROM {forum_discussions}');
     $c_ratuserid = $DB->count_records_sql('SELECT COUNT(DISTINCT userid) FROM {rating}');
     // Count records in backup_ids_table
     $f_forumpost = $DB->count_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => 'forum_post'));
     $f_user1 = $DB->count_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => 'user1'));
     $f_user2 = $DB->count_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => 'user2'));
     $c_notbackupid = $DB->count_records_select('backup_ids_temp', 'backupid != ?', array($backupid));
     // Peform tests by comparing counts
     $this->assertEquals($c_notbackupid, 0);
     // there isn't any record with incorrect backupid
     $this->assertEquals($c_postsid, $f_forumpost);
     // All posts have been registered
     $this->assertEquals($c_dissuserid, $f_user1);
     // All users coming from discussions have been registered
     $this->assertEquals($c_ratuserid, $f_user2);
     // All users coming from ratings have been registered
     // Check file annotations against DB
     $fannotations = $DB->get_records('backup_ids_temp', array('backupid' => $backupid, 'itemname' => 'file'));
     $ffiles = $DB->get_records('files', array('contextid' => $this->contextid));
     $this->assertEquals(count($fannotations), count($ffiles));
     // Same number of recs in both (all files have been annotated)
     foreach ($fannotations as $annotation) {
         // Check ids annotated
         $this->assertTrue($DB->record_exists('files', array('id' => $annotation->itemid)));
     }
     // Drop the backup_ids_temp table
     backup_controller_dbops::drop_backup_ids_temp_table('testingid');
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:101,代码来源:structure_test.php


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