當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Piwik::truncateAllTables方法代碼示例

本文整理匯總了PHP中Piwik::truncateAllTables方法的典型用法代碼示例。如果您正苦於以下問題:PHP Piwik::truncateAllTables方法的具體用法?PHP Piwik::truncateAllTables怎麽用?PHP Piwik::truncateAllTables使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Piwik的用法示例。


在下文中一共展示了Piwik::truncateAllTables方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Piwik_DataTable_Manager::getInstance()->deleteAll();
     Piwik_Option::getInstance()->clearCache();
     Piwik_Common::deleteTrackerCache();
     Piwik_Site::clearCache();
     Piwik::truncateAllTables();
     Piwik_TablePartitioning::$tablesAlreadyInstalled = null;
 }
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:10,代碼來源:Database.test.php

示例2: tearDown

 public function tearDown()
 {
     Piwik::truncateAllTables();
 }
開發者ID:klando,項目名稱:pgpiwik,代碼行數:4,代碼來源:Database.test.php

示例3: restoreDbTables

 /**
  * Truncates all tables then inserts the data in $tables into each
  * mapped table.
  * 
  * @param array $tables Array mapping table names with arrays of row data.
  */
 protected static function restoreDbTables($tables)
 {
     // truncate existing tables
     Piwik::truncateAllTables();
     // insert data
     $existingTables = Piwik::getTablesInstalled();
     foreach ($tables as $table => $rows) {
         // create table if it's an archive table
         if (strpos($table, 'archive_') !== false && !in_array($table, $existingTables)) {
             $tableType = strpos($table, 'archive_numeric') !== false ? 'archive_numeric' : 'archive_blob';
             $createSql = Piwik::getTableCreateSql($tableType);
             $createSql = str_replace(Piwik_Common::prefixTable($tableType), $table, $createSql);
             Piwik_Query($createSql);
         }
         if (empty($rows)) {
             continue;
         }
         $rowsSql = array();
         foreach ($rows as $row) {
             $values = array();
             foreach ($row as $name => $value) {
                 if (is_null($value)) {
                     $values[] = 'NULL';
                 } else {
                     if (is_numeric($value)) {
                         $values[] = $value;
                     } else {
                         if (!ctype_print($value)) {
                             $values[] = "x'" . bin2hex(substr($value, 1)) . "'";
                         } else {
                             $values[] = "'{$value}'";
                         }
                     }
                 }
             }
             $rowsSql[] = "(" . implode(',', $values) . ")";
         }
         $sql = "INSERT INTO {$table} VALUES " . implode(',', $rowsSql);
         Piwik_Query($sql);
     }
 }
開發者ID:nomoto-ubicast,項目名稱:piwik,代碼行數:47,代碼來源:IntegrationTestCase.php

示例4: testPurgeDataDeleteLogsNoData

 /**
  * Test that purgeData works when there's no data.
  *
  * @group Plugins
  * @group PrivacyManager
  */
 public function testPurgeDataDeleteLogsNoData()
 {
     Piwik::truncateAllTables();
     foreach (Piwik::getTablesArchivesInstalled() as $table) {
         Piwik_Exec("DROP TABLE {$table}");
     }
     // get purge data prediction
     $prediction = Piwik_PrivacyManager::getPurgeEstimate();
     // perform checks on prediction
     $expectedPrediction = array();
     $this->assertEquals($expectedPrediction, $prediction);
     // purge data
     $this->_setTimeToRun();
     $this->instance->deleteLogData();
     $this->instance->deleteReportData();
     // perform checks
     $this->assertEquals(0, $this->_getTableCount('log_visit'));
     $this->assertEquals(0, $this->_getTableCount('log_conversion'));
     $this->assertEquals(0, $this->_getTableCount('log_link_visit_action'));
     $this->assertEquals(0, $this->_getTableCount('log_conversion_item'));
     $archiveTables = self::_getArchiveTableNames();
     $this->assertFalse($this->_tableExists($archiveTables['numeric'][0]));
     // January
     $this->assertFalse($this->_tableExists($archiveTables['numeric'][1]));
     // February
     $this->assertFalse($this->_tableExists($archiveTables['blob'][0]));
     // January
     $this->assertFalse($this->_tableExists($archiveTables['blob'][1]));
     // February
 }
開發者ID:nnnnathann,項目名稱:piwik,代碼行數:36,代碼來源:PrivacyManagerTest.php


注:本文中的Piwik::truncateAllTables方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。