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