当前位置: 首页>>代码示例>>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;未经允许,请勿转载。