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


PHP ArchiveTableCreator::getTypeFromTableName方法代碼示例

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


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

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

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

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

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

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

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

示例7: createArchiveTable

 public function createArchiveTable($tableName, $tableNamePrefix)
 {
     $db = Db::get();
     $sql = DbHelper::getTableCreateSql($tableNamePrefix);
     // replace table name template by real name
     $tableNamePrefix = Common::prefixTable($tableNamePrefix);
     $sql = str_replace($tableNamePrefix, $tableName, $sql);
     try {
         $db->query($sql);
     } catch (Exception $e) {
         // accept mysql error 1050: table already exists, throw otherwise
         if (!$db->isErrNo($e, '1050')) {
             throw $e;
         }
     }
     try {
         if (ArchiveTableCreator::NUMERIC_TABLE === ArchiveTableCreator::getTypeFromTableName($tableName)) {
             $sequence = new Sequence($tableName);
             $sequence->create();
         }
     } catch (Exception $e) {
     }
 }
開發者ID:JoeHorn,項目名稱:piwik,代碼行數:23,代碼來源:Model.php

示例8: markArchivesInvalidatedFor

 /**
  * @param $idSites
  * @param $period string
  * @param $datesByMonth array
  * @throws \Exception
  */
 private function markArchivesInvalidatedFor($idSites, $period, $datesByMonth)
 {
     $invalidateForPeriodId = $this->getPeriodId($period);
     // In each table, invalidate day/week/month/year containing this date
     $archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
     $archiveNumericTables = array_filter($archiveTables, function ($name) {
         return ArchiveTableCreator::getTypeFromTableName($name) == ArchiveTableCreator::NUMERIC_TABLE;
     });
     foreach ($archiveNumericTables 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
         $datesToDelete = $datesByMonth[$suffix];
         self::getModel()->updateArchiveAsInvalidated($table, $idSites, $invalidateForPeriodId, $datesToDelete);
     }
 }
開發者ID:bossrabbit,項目名稱:piwik,代碼行數:25,代碼來源:ArchiveInvalidator.php

示例9: getArchiveTablesToPurge

 /**
  * Utility function that finds every archive table whose reports are considered
  * old.
  *
  * @return array An array of two arrays. The first holds the numeric archive table
  *               names, and the second holds the blob archive table names.
  */
 private function getArchiveTablesToPurge()
 {
     // get month for which reports as old or older than, should be deleted
     // reports whose creation date <= this month will be deleted
     // (NOTE: we ignore how far we are in the current month)
     $toRemoveDate = Date::factory('today')->subMonth(1 + $this->deleteReportsOlderThan);
     // find all archive tables that are older than N months
     $oldNumericTables = array();
     $oldBlobTables = array();
     foreach (DbHelper::getTablesInstalled() as $table) {
         $type = ArchiveTableCreator::getTypeFromTableName($table);
         if ($type === false) {
             continue;
         }
         $date = ArchiveTableCreator::getDateFromTableName($table);
         list($year, $month) = explode('_', $date);
         if (self::shouldReportBePurged($year, $month, $toRemoveDate)) {
             if ($type == ArchiveTableCreator::NUMERIC_TABLE) {
                 $oldNumericTables[] = $table;
             } else {
                 $oldBlobTables[] = $table;
             }
         }
     }
     return array($oldNumericTables, $oldBlobTables);
 }
開發者ID:KiwiJuicer,項目名稱:handball-dachau,代碼行數:33,代碼來源:ReportsPurger.php


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