本文整理汇总了PHP中Piwik\ArchiveProcessor\Rules::getDoneFlagArchiveContainsAllPlugins方法的典型用法代码示例。如果您正苦于以下问题:PHP Rules::getDoneFlagArchiveContainsAllPlugins方法的具体用法?PHP Rules::getDoneFlagArchiveContainsAllPlugins怎么用?PHP Rules::getDoneFlagArchiveContainsAllPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\ArchiveProcessor\Rules
的用法示例。
在下文中一共展示了Rules::getDoneFlagArchiveContainsAllPlugins方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: insertArchiveRow
private function insertArchiveRow($idSite, $date, $periodLabel)
{
$periodObject = \Piwik\Period\Factory::build($periodLabel, $date);
$dateStart = $periodObject->getDateStart();
$dateEnd = $periodObject->getDateEnd();
$table = ArchiveTableCreator::getNumericTable($dateStart);
$idArchive = (int) Db::fetchOne("SELECT MAX(idarchive) FROM {$table} WHERE name LIKE 'done%'");
$idArchive = $idArchive + 1;
$periodId = Piwik::$idPeriods[$periodLabel];
$doneFlag = 'done';
if ($idArchive % 5 == 1) {
$doneFlag = Rules::getDoneFlagArchiveContainsAllPlugins(self::$segment1);
} else {
if ($idArchive % 5 == 2) {
$doneFlag .= '.VisitsSummary';
} else {
if ($idArchive % 5 == 3) {
$doneFlag = Rules::getDoneFlagArchiveContainsOnePlugin(self::$segment1, 'UserCountry');
} else {
if ($idArchive % 5 == 4) {
$doneFlag = Rules::getDoneFlagArchiveContainsAllPlugins(self::$segment2);
}
}
}
}
$sql = "INSERT INTO {$table} (idarchive, name, idsite, date1, date2, period, ts_archived)\n VALUES ({$idArchive}, 'nb_visits', {$idSite}, '{$dateStart}', '{$dateEnd}', {$periodId}, NOW()),\n ({$idArchive}, '{$doneFlag}', {$idSite}, '{$dateStart}', '{$dateEnd}', {$periodId}, NOW())";
Db::query($sql);
}
示例2: updateArchiveAsInvalidated
/**
* @param string $archiveTable Prefixed table name
* @param int[] $idSites
* @param string[][] $datesByPeriodType
* @param Segment $segment
* @return \Zend_Db_Statement
* @throws Exception
*/
public function updateArchiveAsInvalidated($archiveTable, $idSites, $datesByPeriodType, Segment $segment = null)
{
$idSites = array_map('intval', $idSites);
$bind = array();
$periodConditions = array();
foreach ($datesByPeriodType as $periodType => $dates) {
$dateConditions = array();
foreach ($dates as $date) {
$dateConditions[] = "(date1 <= ? AND ? <= date2)";
$bind[] = $date;
$bind[] = $date;
}
$dateConditionsSql = implode(" OR ", $dateConditions);
if (empty($periodType) || $periodType == Period\Day::PERIOD_ID) {
// invalidate all periods if no period supplied or period is day
$periodConditions[] = "({$dateConditionsSql})";
} else {
if ($periodType == Period\Range::PERIOD_ID) {
$periodConditions[] = "(period = " . Period\Range::PERIOD_ID . " AND ({$dateConditionsSql}))";
} else {
// for non-day periods, invalidate greater periods, but not range periods
$periodConditions[] = "(period >= " . (int) $periodType . " AND period < " . Period\Range::PERIOD_ID . " AND ({$dateConditionsSql}))";
}
}
}
if ($segment) {
$nameCondition = "name LIKE '" . Rules::getDoneFlagArchiveContainsAllPlugins($segment) . "%'";
} else {
$nameCondition = "name LIKE 'done%'";
}
$sql = "UPDATE {$archiveTable} SET value = " . ArchiveWriter::DONE_INVALIDATED . " WHERE {$nameCondition}\n AND idsite IN (" . implode(", ", $idSites) . ")\n AND (" . implode(" OR ", $periodConditions) . ")";
return Db::query($sql, $bind);
}
示例3: cacheArchiveIdsWithoutLaunching
/**
* Gets the IDs of the archives we're querying for and stores them in $this->archives.
* This function will not launch the archiving process (and is thus much, much faster
* than cacheArchiveIdsAfterLaunching).
*
* @param array $plugins List of plugin names from which data is being requested.
*/
private function cacheArchiveIdsWithoutLaunching($plugins)
{
$idarchivesByReport = ArchiveSelector::getArchiveIds($this->params->getIdSites(), $this->params->getPeriods(), $this->params->getSegment(), $plugins);
// initialize archive ID cache for each report
foreach ($plugins as $plugin) {
$doneFlag = $this->getDoneStringForPlugin($plugin, $this->params->getIdSites());
$this->initializeArchiveIdCache($doneFlag);
$globalDoneFlag = Rules::getDoneFlagArchiveContainsAllPlugins($this->params->getSegment());
$this->initializeArchiveIdCache($globalDoneFlag);
}
foreach ($idarchivesByReport as $doneFlag => $idarchivesByDate) {
foreach ($idarchivesByDate as $dateRange => $idarchives) {
foreach ($idarchives as $idarchive) {
$this->idarchives[$doneFlag][$dateRange][] = $idarchive;
}
}
}
}