本文整理汇总了PHP中Piwik\Site::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getId方法的具体用法?PHP Site::getId怎么用?PHP Site::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Site
的用法示例。
在下文中一共展示了Site::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArchiveIdAndVisits
public static function getArchiveIdAndVisits(Site $site, Period $period, Segment $segment, $minDatetimeArchiveProcessedUTC, $requestedPlugin)
{
$dateStart = $period->getDateStart();
$bindSQL = array($site->getId(), $dateStart->toString('Y-m-d'), $period->getDateEnd()->toString('Y-m-d'), $period->getId());
$timeStampWhere = '';
if ($minDatetimeArchiveProcessedUTC) {
$timeStampWhere = " AND ts_archived >= ? ";
$bindSQL[] = Date::factory($minDatetimeArchiveProcessedUTC)->getDatetime();
}
$pluginOrVisitsSummary = array("VisitsSummary", $requestedPlugin);
$pluginOrVisitsSummary = array_unique($pluginOrVisitsSummary);
$sqlWhereArchiveName = self::getNameCondition($pluginOrVisitsSummary, $segment);
$sqlQuery = "\tSELECT idarchive, value, name, date1 as startDate\n\t\t\t\t\t\tFROM " . ArchiveTableCreator::getNumericTable($dateStart) . "``\n\t\t\t\t\t\tWHERE idsite = ?\n\t\t\t\t\t\t\tAND date1 = ?\n\t\t\t\t\t\t\tAND date2 = ?\n\t\t\t\t\t\t\tAND period = ?\n\t\t\t\t\t\t\tAND ( ({$sqlWhereArchiveName})\n\t\t\t\t\t\t\t\t OR name = '" . self::NB_VISITS_RECORD_LOOKED_UP . "'\n\t\t\t\t\t\t\t\t OR name = '" . self::NB_VISITS_CONVERTED_RECORD_LOOKED_UP . "')\n\t\t\t\t\t\t\t{$timeStampWhere}\n\t\t\t\t\t\tORDER BY idarchive DESC";
$results = Db::fetchAll($sqlQuery, $bindSQL);
if (empty($results)) {
return false;
}
$idArchive = self::getMostRecentIdArchiveFromResults($segment, $requestedPlugin, $results);
$idArchiveVisitsSummary = self::getMostRecentIdArchiveFromResults($segment, "VisitsSummary", $results);
list($visits, $visitsConverted) = self::getVisitsMetricsFromResults($idArchive, $idArchiveVisitsSummary, $results);
if ($visits === false && $idArchive === false) {
return false;
}
return array($idArchive, $visits, $visitsConverted);
}
示例2: setUp
public function setUp()
{
parent::setUp();
$idSite = 1;
if (!Fixture::siteCreated($idSite)) {
Fixture::createWebsite('2014-01-01 00:00:00');
}
$site = new Site($idSite);
$date = Date::factory('2012-01-01');
$period = Period\Factory::build('month', $date);
$segment = new Segment('', array($site->getId()));
$params = new Parameters($site, $period, $segment);
$this->logAggregator = new LogAggregator($params);
}
示例3: getMinTimeProcessedForTemporaryArchive
public static function getMinTimeProcessedForTemporaryArchive(Date $dateStart, \Piwik\Period $period, Segment $segment, Site $site)
{
$now = time();
$minimumArchiveTime = $now - Rules::getTodayArchiveTimeToLive();
$idSites = array($site->getId());
$isArchivingDisabled = Rules::isArchivingDisabledFor($idSites, $segment, $period->getLabel());
if ($isArchivingDisabled) {
if ($period->getNumberOfSubperiods() == 0 && $dateStart->getTimestamp() <= $now) {
// Today: accept any recent enough archive
$minimumArchiveTime = false;
} else {
// This week, this month, this year:
// accept any archive that was processed today after 00:00:01 this morning
$timezone = $site->getTimezone();
$minimumArchiveTime = Date::factory(Date::factory('now', $timezone)->getDateStartUTC())->setTimezone($timezone)->getTimestamp();
}
}
return $minimumArchiveTime;
}
示例4: prepareArchive
/**
* @param $archiveGroups
* @param $site
* @param $period
*/
private function prepareArchive(array $archiveGroups, Site $site, Period $period)
{
$parameters = new ArchiveProcessor\Parameters($site, $period, $this->params->getSegment());
$archiveLoader = new ArchiveProcessor\Loader($parameters);
$periodString = $period->getRangeString();
$idSites = array($site->getId());
// process for each plugin as well
foreach ($archiveGroups as $plugin) {
$doneFlag = $this->getDoneStringForPlugin($plugin, $idSites);
$this->initializeArchiveIdCache($doneFlag);
$idArchive = $archiveLoader->prepareArchive($plugin);
if ($idArchive) {
$this->idarchives[$doneFlag][$periodString][] = $idArchive;
}
}
}
示例5: getBindDatetimeSite
protected function getBindDatetimeSite()
{
return array($this->dateStart->getDateStartUTC(), $this->dateEnd->getDateEndUTC(), $this->site->getId());
}
示例6: getArchiveIdAndVisits
public function getArchiveIdAndVisits($table, \Piwik\Site $site, \Piwik\Period $period, $minDatetime, $sqlWhereArchiveName)
{
$bind = array($site->getId(), $period->getDateStart()->toString('Y-m-d'), $period->getDateEnd()->toString('Y-m-d'), $period->getId());
if ($minDatetime) {
$timestampWhere = ' AND ts_archived >= ?';
$bind[] = Date::factory($minDatetime)->getDatetime();
} else {
$timestampWhere = '';
}
$startDate = $this->db->quoteIdentifier('startDate');
$sql = "SELECT idarchive, value, name, date1 AS {$startDate}\n FROM {$table}\n WHERE idsite = ?\n AND date1 = ?\n AND date2 = ?\n AND period = ?\n AND ( ({$sqlWhereArchiveName})\n OR name = '" . ArchiveSelector::NB_VISITS_RECORD_LOOKED_UP . "'\n OR name = '" . ArchiveSelector::NB_VISITS_CONVERTED_RECORD_LOOKED_UP . "'\n )\n {$timestampWhere}\n ORDER BY idarchive DESC";
return $this->db->fetchAll($sql, $bind);
}