本文整理汇总了PHP中Piwik\DataAccess\ArchiveTableCreator::getTablesArchivesInstalled方法的典型用法代码示例。如果您正苦于以下问题:PHP ArchiveTableCreator::getTablesArchivesInstalled方法的具体用法?PHP ArchiveTableCreator::getTablesArchivesInstalled怎么用?PHP ArchiveTableCreator::getTablesArchivesInstalled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\DataAccess\ArchiveTableCreator
的用法示例。
在下文中一共展示了ArchiveTableCreator::getTablesArchivesInstalled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: purgeInvalidatedArchives
public static function purgeInvalidatedArchives()
{
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
foreach ($archiveTables as $archiveTable) {
/**
* Select the archives that have already been invalidated and have been since re-processed.
* It purges records for each distinct { archive name (includes segment hash) , idsite, date, period } tuple.
*/
$query = '
SELECT t1.idarchive FROM `' . $archiveTable . '` t1
INNER JOIN `' . $archiveTable . '` t2
ON t1.name = t2.name AND t1.idsite=t2.idsite
AND t1.date1=t2.date1 AND t1.date2=t2.date2 AND t1.period=t2.period
WHERE t1.value = ' . ArchiveWriter::DONE_INVALIDATED . '
AND t2.value IN(' . ArchiveWriter::DONE_OK . ', ' . ArchiveWriter::DONE_OK_TEMPORARY . ')
AND t1.ts_archived < t2.ts_archived AND t1.name LIKE \'done%\'';
$result = Db::fetchAll($query);
if (count($result) > 0) {
$archiveIds = array_map(function ($elm) {
return $elm['idarchive'];
}, $result);
$date = ArchiveTableCreator::getDateFromTableName($archiveTable);
$date = Date::factory(str_replace('_', '-', $date) . '-01');
self::deleteArchiveIds($date, $archiveIds);
}
}
}
示例2: 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);
}
}
示例3: tearDown
public function tearDown()
{
// clean up your test here if needed
$tables = ArchiveTableCreator::getTablesArchivesInstalled();
if (!empty($tables)) {
Db::dropTables($tables);
}
parent::tearDown();
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
示例10: purgeInvalidatedArchives
public static function purgeInvalidatedArchives()
{
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
foreach ($archiveTables as $archiveTable) {
/**
* Select the archives that have already been invalidated and have been since re-processed.
* It purges records for each distinct { archive name (includes segment hash) , idsite, date, period } tuple.
*/
$result = self::getModel()->purgeInvalidatedArchiveTable($archiveTable);
if (count($result) > 0) {
$archiveIds = array_map(function ($elm) {
return $elm['idarchive'];
}, $result);
$date = ArchiveTableCreator::getDateFromTableName($archiveTable);
$date = Date::factory(str_replace('_', '-', $date) . '-01');
self::deleteArchiveIds($date, $archiveIds);
}
}
}
示例11: test_getTablesArchivesInstalled_CorrectlyFiltersTableNames
/**
* @dataProvider getTestDataForGetTablesArchivesInstalled
*/
public function test_getTablesArchivesInstalled_CorrectlyFiltersTableNames($type, $expectedTables)
{
ArchiveTableCreator::$tablesAlreadyInstalled = $this->tables;
$tables = ArchiveTableCreator::getTablesArchivesInstalled($type);
$this->assertEquals($expectedTables, $tables);
}
示例12: tablesCreation
/**
* Installation Step 5: Table Creation
*/
function tablesCreation()
{
$this->checkPreviousStepIsValid(__FUNCTION__);
$view = new View('@Installation/tablesCreation', $this->getInstallationSteps(), __FUNCTION__);
$this->skipThisStep(__FUNCTION__);
$this->createDbFromSessionInformation();
if (Common::getRequestVar('deleteTables', 0, 'int') == 1) {
DbHelper::dropTables();
$view->existingTablesDeleted = true;
// when the user decides to drop the tables then we dont skip the next steps anymore
// workaround ZF-1743
$tmp = $this->session->skipThisStep;
$tmp['firstWebsiteSetup'] = false;
$tmp['trackingCode'] = false;
$this->session->skipThisStep = $tmp;
}
$tablesInstalled = DbHelper::getTablesInstalled();
$view->tablesInstalled = '';
if (count($tablesInstalled) > 0) {
// we have existing tables
$view->tablesInstalled = implode(', ', $tablesInstalled);
$view->someTablesInstalled = true;
// remove monthly archive tables
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
$baseTablesInstalled = count($tablesInstalled) - count($archiveTables);
$minimumCountPiwikTables = 17;
Access::getInstance();
Piwik::setUserIsSuperUser();
if ($baseTablesInstalled >= $minimumCountPiwikTables && count(APISitesManager::getInstance()->getAllSitesId()) > 0 && count(APIUsersManager::getInstance()->getUsers()) > 0) {
$view->showReuseExistingTables = true;
// when the user reuses the same tables we skip the website creation step
// workaround ZF-1743
$tmp = $this->session->skipThisStep;
$tmp['firstWebsiteSetup'] = true;
$tmp['trackingCode'] = true;
$this->session->skipThisStep = $tmp;
}
} else {
DbHelper::createTables();
DbHelper::createAnonymousUser();
Updater::recordComponentSuccessfullyUpdated('core', Version::VERSION);
$view->tablesCreated = true;
$view->showNextStep = true;
}
$this->session->currentStepDone = __FUNCTION__;
return $view->render();
}
示例13: markArchivesInvalidated
/**
* @param int[] $idSites
* @param string[][][] $dates
* @throws \Exception
*/
private function markArchivesInvalidated($idSites, $dates, Segment $segment = null)
{
$archiveNumericTables = ArchiveTableCreator::getTablesArchivesInstalled($type = ArchiveTableCreator::NUMERIC_TABLE);
foreach ($archiveNumericTables as $table) {
$tableDate = ArchiveTableCreator::getDateFromTableName($table);
if (empty($dates[$tableDate])) {
continue;
}
$this->model->updateArchiveAsInvalidated($table, $idSites, $dates[$tableDate], $segment);
}
}
示例14: optimizeArchiveTable
public function optimizeArchiveTable()
{
$archiveTables = ArchiveTableCreator::getTablesArchivesInstalled();
Db::optimizeTables($archiveTables);
}
示例15: getInvalidatedArchives
private function getInvalidatedArchives()
{
$result = array();
foreach (ArchiveTableCreator::getTablesArchivesInstalled(ArchiveTableCreator::NUMERIC_TABLE) as $table) {
$date = ArchiveTableCreator::getDateFromTableName($table);
$sql = "SELECT CONCAT(idsite, '.', date1, '.', date2, '.', period, '.', name) FROM {$table} WHERE name LIKE 'done%' AND value = ?";
$archiveSpecs = Db::fetchAll($sql, array(ArchiveWriter::DONE_INVALIDATED));
$archiveSpecs = array_map('reset', $archiveSpecs);
$result[$date] = $archiveSpecs;
}
return $result;
}