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


PHP DataAccess\ArchiveTableCreator类代码示例

本文整理汇总了PHP中Piwik\DataAccess\ArchiveTableCreator的典型用法代码示例。如果您正苦于以下问题:PHP ArchiveTableCreator类的具体用法?PHP ArchiveTableCreator怎么用?PHP ArchiveTableCreator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: beforeTableDataCached

 protected static function beforeTableDataCached()
 {
     $date = Date::factory('2010-03-01');
     $archiveTableCreator = new ArchiveTableCreator();
     $archiveTableCreator->getBlobTable($date);
     $archiveTableCreator->getNumericTable($date);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:ArchiveTest.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ArchiveTableCreator::getNumericTable(Date::factory('2015-01-01'));
     ArchiveTableCreator::getNumericTable(Date::factory('2015-02-02'));
     ArchiveTableCreator::getNumericTable(Date::factory('2015-03-03'));
 }
开发者ID:dorelljames,项目名称:piwik,代码行数:7,代码来源:OptimizeArchiveTablesTest.php

示例3: setUp

 public function setUp()
 {
     parent::setUp();
     $this->archiveTableDao = self::$fixture->piwikEnvironment->getContainer()->get('Piwik\\DataAccess\\ArchiveTableDao');
     ArchiveTableCreator::getBlobTable(Date::factory('2015-01-01'));
     ArchiveTableCreator::getNumericTable(Date::factory('2015-01-01'));
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:7,代码来源:ArchiveTableDaoTest.php

示例4: setUp

 public function setUp()
 {
     $archivingTables = ArchiveTableCreator::getTablesArchivesInstalled();
     if (empty($archivingTables)) {
         $this->archivingLaunched = true;
         APIVisitsSummary::getInstance()->get(self::$fixture->idSite, self::$fixture->period, self::$fixture->date);
     }
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:8,代码来源:MultiSitesBenchmark.php

示例5: tearDown

 public function tearDown()
 {
     // clean up your test here if needed
     $tables = ArchiveTableCreator::getTablesArchivesInstalled();
     if (!empty($tables)) {
         Db::dropTables($tables);
     }
     parent::tearDown();
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:VisitsSummaryTest.php

示例6: test_UpdateCommand_ReturnsCorrectExitCode_WhenErrorOccurs

 public function test_UpdateCommand_ReturnsCorrectExitCode_WhenErrorOccurs()
 {
     // create a blob table, then drop it manually so update 2.10.0-b10 will fail
     $tableName = ArchiveTableCreator::getBlobTable(Date::factory('2015-01-01'));
     Db::exec("DROP TABLE {$tableName}");
     $result = $this->applicationTester->run(array('command' => 'core:update', '--yes' => true));
     $this->assertEquals(1, $result, $this->getCommandDisplayOutputErrorMessage());
     $this->assertContains("Piwik could not be updated! See above for more information.", $this->applicationTester->getDisplay());
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:9,代码来源:UpdateTest.php

示例7: getSql

 public static function getSql()
 {
     $sqls = array();
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     $archiveBlobTables = array_filter($archiveTables, function ($name) {
         return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
     });
     foreach ($archiveBlobTables as $table) {
         $sqls["UPDATE " . $table . " SET name = 'DevicePlugins_plugin' WHERE name = 'UserSettings_plugin'"] = false;
     }
     return $sqls;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:12,代码来源:2.10.0-b10.php

示例8: getMigrations

 public function getMigrations(Updater $updater)
 {
     $migrations = array();
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     $archiveBlobTables = array_filter($archiveTables, function ($name) {
         return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
     });
     foreach ($archiveBlobTables as $table) {
         $migrations[] = $this->migration->db->sql("UPDATE {$table} SET name = 'DevicePlugins_plugin' WHERE name = 'UserSettings_plugin'");
     }
     return $migrations;
 }
开发者ID:piwik,项目名称:piwik,代码行数:12,代码来源:2.10.0-b10.php

示例9: getAllArchiveBlobTables

 /**
  * Returns all available archive blob tables
  *
  * @return array
  */
 public static function getAllArchiveBlobTables()
 {
     if (empty(self::$archiveBlobTables)) {
         $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
         self::$archiveBlobTables = array_filter($archiveTables, function ($name) {
             return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
         });
         // sort tables so we have them in order of their date
         rsort(self::$archiveBlobTables);
     }
     return (array) self::$archiveBlobTables;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:17,代码来源:2.10.0-b5.php

示例10: getMigrationQueries

 public function getMigrationQueries(Updater $updater)
 {
     $sqls = array();
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     $archiveBlobTables = array_filter($archiveTables, function ($name) {
         return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::BLOB_TABLE;
     });
     foreach ($archiveBlobTables as $table) {
         $sqls["UPDATE " . $table . " SET name = 'UserLanguage_language' WHERE name = 'UserSettings_language'"] = false;
     }
     return $sqls;
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:12,代码来源:2.11.0-b4.php

示例11: deleteArchiveIds

 protected static function deleteArchiveIds(Date $date, $idArchivesToDelete)
 {
     $batches = array_chunk($idArchivesToDelete, 1000);
     foreach ($batches as $idsToDelete) {
         $query = "DELETE FROM %s WHERE idarchive IN (" . implode(',', $idsToDelete) . ")";
         Db::query(sprintf($query, ArchiveTableCreator::getNumericTable($date)));
         try {
             Db::query(sprintf($query, ArchiveTableCreator::getBlobTable($date)));
         } catch (Exception $e) {
             // Individual blob tables could be missing
         }
     }
 }
开发者ID:a4tunado,项目名称:piwik,代码行数:13,代码来源:ArchivePurger.php

示例12: addArchivingIdMigrationQueries

 private function addArchivingIdMigrationQueries($sql)
 {
     $tables = ArchiveTableCreator::getTablesArchivesInstalled();
     foreach ($tables as $table) {
         $type = ArchiveTableCreator::getTypeFromTableName($table);
         if ($type === ArchiveTableCreator::NUMERIC_TABLE) {
             $maxId = Db::fetchOne('SELECT MAX(idarchive) FROM ' . $table);
             if (!empty($maxId)) {
                 $maxId = (int) $maxId + 500;
             } else {
                 $maxId = 1;
             }
             $sql[] = $this->migration->db->insert($this->sequenceTable, array('name' => $table, 'value' => $maxId));
         }
     }
     return $sql;
 }
开发者ID:piwik,项目名称:piwik,代码行数:17,代码来源:2.9.0-b7.php

示例13: addArchivingIdMigrationQueries

 private static function addArchivingIdMigrationQueries($sql)
 {
     $tables = ArchiveTableCreator::getTablesArchivesInstalled();
     foreach ($tables as $table) {
         $type = ArchiveTableCreator::getTypeFromTableName($table);
         if ($type === ArchiveTableCreator::NUMERIC_TABLE) {
             $maxId = Db::fetchOne('SELECT MAX(idarchive) FROM ' . $table);
             if (!empty($maxId)) {
                 $maxId = (int) $maxId + 500;
             } else {
                 $maxId = 1;
             }
             $query = self::getQueryToCreateSequence($table, $maxId);
             // refs  #6696, ignores  Integrity constraint violation: 1062 Duplicate entry 'piwik_archive_numeric_2010_01' for key 'PRIMARY'
             $sql[$query] = '1062';
         }
     }
     return $sql;
 }
开发者ID:CaptainSharf,项目名称:SSAD_Project,代码行数:19,代码来源:2.9.0-b7.php

示例14: deleteArchiveTables

 /**
  * Drops all archive tables.
  */
 public static function deleteArchiveTables()
 {
     foreach (ArchiveTableCreator::getTablesArchivesInstalled() as $table) {
         Log::debug("Dropping table {$table}");
         Db::query("DROP TABLE IF EXISTS `{$table}`");
     }
     ArchiveTableCreator::refreshTableList($forceReload = true);
 }
开发者ID:Abine,项目名称:piwik,代码行数:11,代码来源:IntegrationTestCase.php

示例15: invalidateArchivedReports

 /**
  * When tracking data in the past (using Tracking API), this function
  * can be used to invalidate reports for the idSites and dates where new data
  * was added.
  * DEV: If you call this API, the UI should display the data correctly, but will process
  *      in real time, which could be very slow after large data imports.
  *      After calling this function via REST, you can manually force all data
  *      to be reprocessed by visiting the script as the Super User:
  *      http://example.net/piwik/misc/cron/archive.php?token_auth=$SUPER_USER_TOKEN_AUTH_HERE
  * REQUIREMENTS: On large piwik setups, you will need in PHP configuration: max_execution_time = 0
  *    We recommend to use an hourly schedule of the script.
  *    More information: http://piwik.org/setup-auto-archiving/
  *
  * @param string $idSites Comma separated list of idSite that have had data imported for the specified dates
  * @param string $dates Comma separated list of dates to invalidate for all these websites
  * @throws Exception
  * @return array
  */
 public function invalidateArchivedReports($idSites, $dates)
 {
     $idSites = Site::getIdSitesFromIdSitesString($idSites);
     if (empty($idSites)) {
         throw new Exception("Specify a value for &idSites= as a comma separated list of website IDs, for which your token_auth has 'admin' permission");
     }
     Piwik::checkUserHasAdminAccess($idSites);
     // Ensure the specified dates are valid
     $toInvalidate = $invalidDates = array();
     $dates = explode(',', trim($dates));
     $dates = array_unique($dates);
     foreach ($dates as $theDate) {
         $theDate = trim($theDate);
         try {
             $date = Date::factory($theDate);
         } catch (Exception $e) {
             $invalidDates[] = $theDate;
             continue;
         }
         if ($date->toString() == $theDate) {
             $toInvalidate[] = $date;
         } else {
             $invalidDates[] = $theDate;
         }
     }
     // If using the feature "Delete logs older than N days"...
     $purgeDataSettings = PrivacyManager::getPurgeDataSettings();
     $logsAreDeletedBeforeThisDate = $purgeDataSettings['delete_logs_schedule_lowest_interval'];
     $logsDeleteEnabled = $purgeDataSettings['delete_logs_enable'];
     $minimumDateWithLogs = false;
     if ($logsDeleteEnabled && $logsAreDeletedBeforeThisDate) {
         $minimumDateWithLogs = Date::factory('today')->subDay($logsAreDeletedBeforeThisDate);
     }
     // Given the list of dates, process which tables they should be deleted from
     $minDate = false;
     $warningDates = $processedDates = array();
     /* @var $date Date */
     foreach ($toInvalidate as $date) {
         // we should only delete reports for dates that are more recent than N days
         if ($minimumDateWithLogs && $date->isEarlier($minimumDateWithLogs)) {
             $warningDates[] = $date->toString();
         } else {
             $processedDates[] = $date->toString();
         }
         $month = $date->toString('Y_m');
         // For a given date, we must invalidate in the monthly archive table
         $datesByMonth[$month][] = $date->toString();
         // But also the year stored in January
         $year = $date->toString('Y_01');
         $datesByMonth[$year][] = $date->toString();
         // but also weeks overlapping several months stored in the month where the week is starting
         /* @var $week Week */
         $week = Period\Factory::build('week', $date);
         $weekAsString = $week->getDateStart()->toString('Y_m');
         $datesByMonth[$weekAsString][] = $date->toString();
         // Keep track of the minimum date for each website
         if ($minDate === false || $date->isEarlier($minDate)) {
             $minDate = $date;
         }
     }
     if (empty($minDate)) {
         throw new Exception("Check the 'dates' parameter is a valid date.");
     }
     // In each table, invalidate day/week/month/year containing this date
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     foreach ($archiveTables as $table) {
         // Extract Y_m from table name
         $suffix = ArchiveTableCreator::getDateFromTableName($table);
         if (!isset($datesByMonth[$suffix])) {
             continue;
         }
         // Dates which are to be deleted from this table
         $datesToDeleteInTable = $datesByMonth[$suffix];
         // Build one statement to delete all dates from the given table
         $sql = $bind = array();
         $datesToDeleteInTable = array_unique($datesToDeleteInTable);
         foreach ($datesToDeleteInTable as $dateToDelete) {
             $sql[] = '(date1 <= ? AND ? <= date2)';
             $bind[] = $dateToDelete;
             $bind[] = $dateToDelete;
         }
         $sql = implode(" OR ", $sql);
//.........这里部分代码省略.........
开发者ID:brienomatty,项目名称:elmsln,代码行数:101,代码来源:API.php


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