diff --git a/core/API/DataTableManipulator.php b/core/API/DataTableManipulator.php
index b56cb144969..adcb2eaeedb 100644
--- a/core/API/DataTableManipulator.php
+++ b/core/API/DataTableManipulator.php
@@ -171,7 +171,8 @@ protected function getApiMethodForSubtable($request)
if (empty($meta)) {
throw new Exception(sprintf(
"The DataTable cannot be manipulated: Metadata for report %s.%s could not be found. You can define the metadata in a hook, see example at: %s",
- $this->apiModule, $this->apiMethod,
+ $this->apiModule,
+ $this->apiMethod,
Url::addCampaignParametersToMatomoLink('https://developer.matomo.org/api-reference/events#apigetreportmetadata')
));
}
diff --git a/core/API/DataTablePostProcessor.php b/core/API/DataTablePostProcessor.php
index 65407229942..1c4484466be 100644
--- a/core/API/DataTablePostProcessor.php
+++ b/core/API/DataTablePostProcessor.php
@@ -249,7 +249,11 @@ public function applyProcessedMetricsGenericFilters($dataTable)
$addNormalProcessedMetrics = null;
try {
$addNormalProcessedMetrics = Common::getRequestVar(
- 'filter_add_columns_when_show_all_columns', null, 'integer', $this->request);
+ 'filter_add_columns_when_show_all_columns',
+ null,
+ 'integer',
+ $this->request
+ );
} catch (Exception $ex) {
// ignore
}
@@ -261,7 +265,11 @@ public function applyProcessedMetricsGenericFilters($dataTable)
$addGoalProcessedMetrics = null;
try {
$addGoalProcessedMetrics = Common::getRequestVar(
- 'filter_update_columns_when_show_all_goals', false, 'string', $this->request);
+ 'filter_update_columns_when_show_all_goals',
+ false,
+ 'string',
+ $this->request
+ );
if ((int) $addGoalProcessedMetrics === 0
&& $addGoalProcessedMetrics !== '0'
&& $addGoalProcessedMetrics != Piwik::LABEL_ID_GOAL_IS_ECOMMERCE_ORDER
diff --git a/core/API/Request.php b/core/API/Request.php
index f12eb738931..6dbd1a226c7 100644
--- a/core/API/Request.php
+++ b/core/API/Request.php
@@ -474,8 +474,10 @@ public static function checkTokenAuthIsNotLimited($module, $action)
}
if (Access::getInstance()->hasSuperUserAccess()) {
- $ex = new \Piwik\Exception\Exception(Piwik::translate('Widgetize_TooHighAccessLevel',
- ['', '']));
+ $ex = new \Piwik\Exception\Exception(Piwik::translate(
+ 'Widgetize_TooHighAccessLevel',
+ ['', '']
+ ));
$ex->setIsHtmlMessage();
throw $ex;
}
@@ -491,9 +493,11 @@ public static function checkTokenAuthIsNotLimited($module, $action)
//
// NOTE: this does not apply if the [General] enable_framed_allow_write_admin_token_auth INI
// option is set.
- $ex = new \Piwik\Exception\Exception(Piwik::translate('Widgetize_ViewAccessRequired',
+ $ex = new \Piwik\Exception\Exception(Piwik::translate(
+ 'Widgetize_ViewAccessRequired',
['https://matomo.org/faq/troubleshooting/faq_147/']));
+ '" rel="noreferrer noopener">https://matomo.org/faq/troubleshooting/faq_147/']
+ ));
$ex->setIsHtmlMessage();
throw $ex;
}
diff --git a/core/Access.php b/core/Access.php
index 918b123b39d..5e69c56d060 100644
--- a/core/Access.php
+++ b/core/Access.php
@@ -363,10 +363,11 @@ public function getSitesIdWithAtLeastViewAccess()
$this->loadSitesIfNeeded();
return array_unique(array_merge(
- $this->idsitesByAccess['view'],
- $this->idsitesByAccess['write'],
- $this->idsitesByAccess['admin'],
- $this->idsitesByAccess['superuser']));
+ $this->idsitesByAccess['view'],
+ $this->idsitesByAccess['write'],
+ $this->idsitesByAccess['admin'],
+ $this->idsitesByAccess['superuser']
+ ));
}
/**
@@ -381,9 +382,10 @@ public function getSitesIdWithAtLeastWriteAccess()
$this->loadSitesIfNeeded();
return array_unique(array_merge(
- $this->idsitesByAccess['write'],
- $this->idsitesByAccess['admin'],
- $this->idsitesByAccess['superuser']));
+ $this->idsitesByAccess['write'],
+ $this->idsitesByAccess['admin'],
+ $this->idsitesByAccess['superuser']
+ ));
}
/**
@@ -397,8 +399,9 @@ public function getSitesIdWithAdminAccess()
$this->loadSitesIfNeeded();
return array_unique(array_merge(
- $this->idsitesByAccess['admin'],
- $this->idsitesByAccess['superuser']));
+ $this->idsitesByAccess['admin'],
+ $this->idsitesByAccess['superuser']
+ ));
}
/**
diff --git a/core/Application/Kernel/EnvironmentValidator.php b/core/Application/Kernel/EnvironmentValidator.php
index d2f4db51e1d..19bee5aad20 100644
--- a/core/Application/Kernel/EnvironmentValidator.php
+++ b/core/Application/Kernel/EnvironmentValidator.php
@@ -120,9 +120,13 @@ private function getMessageWhenFileExistsButNotReadable($path)
$format = "\n ยป %s \n";
}
- return sprintf($format,
- $this->translator->translate('General_ExceptionConfigurationFilePleaseCheckReadableByUser',
- array($path, Filechecks::getUser())));
+ return sprintf(
+ $format,
+ $this->translator->translate(
+ 'General_ExceptionConfigurationFilePleaseCheckReadableByUser',
+ array($path, Filechecks::getUser())
+ )
+ );
}
/**
@@ -137,8 +141,10 @@ private function getSpecificMessageWhetherFileExistsOrNot($path)
$message .= $this->getMessageWhenFileExistsButNotReadable($path);
}
} else {
- $message = $this->translator->translate('General_ExceptionConfigurationFileExistsButNotReadable',
- array($path));
+ $message = $this->translator->translate(
+ 'General_ExceptionConfigurationFileExistsButNotReadable',
+ array($path)
+ );
$message .= $this->getMessageWhenFileExistsButNotReadable($path);
}
diff --git a/core/Archive/ArchiveInvalidator.php b/core/Archive/ArchiveInvalidator.php
index a25dc4ad30b..4f6292ebbe8 100644
--- a/core/Archive/ArchiveInvalidator.php
+++ b/core/Archive/ArchiveInvalidator.php
@@ -524,8 +524,15 @@ public function reArchiveReport($idSites, string $plugin = null, string $report
) {
foreach ($idSites as $idSite) {
foreach (Rules::getSegmentsToProcess([$idSite]) as $segment) {
- $this->markArchivesAsInvalidated($idSites, $dates, 'day', new Segment($segment, [$idSite]),
- $cascadeDown = false, $forceInvalidateRanges = false, $name);
+ $this->markArchivesAsInvalidated(
+ $idSites,
+ $dates,
+ 'day',
+ new Segment($segment, [$idSite]),
+ $cascadeDown = false,
+ $forceInvalidateRanges = false,
+ $name
+ );
}
}
}
diff --git a/core/Archive/ArchivePurger.php b/core/Archive/ArchivePurger.php
index de67f2740dc..1eb6544fb23 100644
--- a/core/Archive/ArchivePurger.php
+++ b/core/Archive/ArchivePurger.php
@@ -204,7 +204,9 @@ protected function getDeletedSegmentArchiveIds(Date $date, array $deletedSegment
{
$archiveTable = ArchiveTableCreator::getNumericTable($date);
return $this->model->getArchiveIdsForSegments(
- $archiveTable, $deletedSegments, $this->getOldestTemporaryArchiveToKeepThreshold()
+ $archiveTable,
+ $deletedSegments,
+ $this->getOldestTemporaryArchiveToKeepThreshold()
);
}
@@ -236,7 +238,11 @@ public function purgeArchivesWithPeriodRange(Date $date)
$blobTable = ArchiveTableCreator::getBlobTable($date);
$deletedCount = $this->model->deleteArchivesWithPeriod(
- $numericTable, $blobTable, Piwik::$idPeriods['range'], $this->purgeCustomRangesOlderThan);
+ $numericTable,
+ $blobTable,
+ Piwik::$idPeriods['range'],
+ $this->purgeCustomRangesOlderThan
+ );
$level = $deletedCount == 0 ? 'debug' : 'info';
$this->logger->$level("Purged {count} range archive rows from {numericTable} & {blobTable}.", array(
diff --git a/core/Archive/DataCollection.php b/core/Archive/DataCollection.php
index 1ed30f380a8..2ebb3a537a2 100644
--- a/core/Archive/DataCollection.php
+++ b/core/Archive/DataCollection.php
@@ -237,7 +237,13 @@ public function getIndexedArray($resultIndices)
public function getDataTable($resultIndices)
{
$dataTableFactory = new DataTableFactory(
- $this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->segment, $this->defaultRow);
+ $this->dataNames,
+ $this->dataType,
+ $this->sitesId,
+ $this->periods,
+ $this->segment,
+ $this->defaultRow
+ );
$index = $this->getIndexedArray($resultIndices);
@@ -254,7 +260,13 @@ public function getDataTable($resultIndices)
public function getMergedDataTable($resultIndices)
{
$dataTableFactory = new DataTableFactory(
- $this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->segment, $this->defaultRow);
+ $this->dataNames,
+ $this->dataType,
+ $this->sitesId,
+ $this->periods,
+ $this->segment,
+ $this->defaultRow
+ );
$index = $this->getIndexedArray($resultIndices);
@@ -286,7 +298,13 @@ public function getExpandedDataTable($resultIndices, $idSubTable = null, $depth
$this->checkExpandedMethodPrerequisites();
$dataTableFactory = new DataTableFactory(
- $this->dataNames, 'blob', $this->sitesId, $this->periods, $this->segment, $this->defaultRow);
+ $this->dataNames,
+ 'blob',
+ $this->sitesId,
+ $this->periods,
+ $this->segment,
+ $this->defaultRow
+ );
$dataTableFactory->expandDataTable($depth, $addMetadataSubTableId);
$dataTableFactory->useSubtable($idSubTable);
diff --git a/core/ArchiveProcessor/ArchivingStatus.php b/core/ArchiveProcessor/ArchivingStatus.php
index 3f90b2b6d83..10f32edd5f5 100644
--- a/core/ArchiveProcessor/ArchivingStatus.php
+++ b/core/ArchiveProcessor/ArchivingStatus.php
@@ -102,10 +102,19 @@ public function getSitesCurrentlyArchiving()
*/
private function makeArchivingLock(Parameters $params)
{
- $doneFlag = Rules::getDoneStringFlagFor([$params->getSite()->getId()], $params->getSegment(),
- $params->getPeriod()->getLabel(), $params->getRequestedPlugin());
- return $this->makeArchivingLockFromDoneFlag($params->getSite()->getId(), $params->getSite()->getId(), $params->getPeriod()->getDateStart()->toString(),
- $params->getPeriod()->getDateEnd()->toString(), $doneFlag);
+ $doneFlag = Rules::getDoneStringFlagFor(
+ [$params->getSite()->getId()],
+ $params->getSegment(),
+ $params->getPeriod()->getLabel(),
+ $params->getRequestedPlugin()
+ );
+ return $this->makeArchivingLockFromDoneFlag(
+ $params->getSite()->getId(),
+ $params->getSite()->getId(),
+ $params->getPeriod()->getDateStart()->toString(),
+ $params->getPeriod()->getDateEnd()->toString(),
+ $doneFlag
+ );
}
private function makeArchivingLockFromDoneFlag($idSite, $date1, $date2, $period, $doneFlag)
diff --git a/core/ArchiveProcessor/Loader.php b/core/ArchiveProcessor/Loader.php
index 0fd5071c3bf..3097acc0484 100644
--- a/core/ArchiveProcessor/Loader.php
+++ b/core/ArchiveProcessor/Loader.php
@@ -203,8 +203,12 @@ protected function insertArchiveData($visits, $visitsConverted, $existingArchive
*/
private function makeArchivingLockId()
{
- $doneFlag = Rules::getDoneStringFlagFor([$this->params->getSite()->getId()], $this->params->getSegment(),
- $this->params->getPeriod()->getLabel(), $this->params->getRequestedPlugin());
+ $doneFlag = Rules::getDoneStringFlagFor(
+ [$this->params->getSite()->getId()],
+ $this->params->getSegment(),
+ $this->params->getPeriod()->getLabel(),
+ $this->params->getRequestedPlugin()
+ );
return $this->params->getPeriod()->getDateStart()->toString() . $this->params->getPeriod()->getDateEnd()->toString() . '.' . $doneFlag;
}
@@ -605,7 +609,11 @@ private function shouldForceInvalidatedArchive($value, $tsArchived)
// if coming from a browser request, and period does contain today, check the ttl for the period (done just below this)
$minDatetimeArchiveProcessedUTC = Rules::getMinTimeProcessedForInProgressArchive(
- $params->getDateStart(), $params->getPeriod(), $params->getSegment(), $params->getSite());
+ $params->getDateStart(),
+ $params->getPeriod(),
+ $params->getSegment(),
+ $params->getSite()
+ );
$minDatetimeArchiveProcessedUTC = Date::factory($minDatetimeArchiveProcessedUTC);
if ($minDatetimeArchiveProcessedUTC
&& Date::factory($tsArchived)->isEarlier($minDatetimeArchiveProcessedUTC)
diff --git a/core/ArchiveProcessor/PluginsArchiver.php b/core/ArchiveProcessor/PluginsArchiver.php
index 0e0cd1911bf..793ecc267c7 100644
--- a/core/ArchiveProcessor/PluginsArchiver.php
+++ b/core/ArchiveProcessor/PluginsArchiver.php
@@ -127,8 +127,12 @@ public function callAggregateCoreMetrics()
*/
public function callAggregateAllPlugins($visits, $visitsConverted, $forceArchivingWithoutVisits = false)
{
- Log::debug("PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, visits converted = %s]",
- __FUNCTION__, $visits, $visitsConverted);
+ Log::debug(
+ "PluginsArchiver::%s: Initializing archiving process for all plugins [visits = %s, visits converted = %s]",
+ __FUNCTION__,
+ $visits,
+ $visitsConverted
+ );
/** @var Logger $performanceLogger */
$performanceLogger = StaticContainer::get(Logger::class);
@@ -189,7 +193,8 @@ public function callAggregateAllPlugins($visits, $visitsConverted, $forceArchivi
$performanceLogger->logMeasurement('plugin', $pluginName, $this->params, $timer);
- Log::debug("PluginsArchiver::%s: %s while archiving %s reports for plugin '%s' %s.",
+ Log::debug(
+ "PluginsArchiver::%s: %s while archiving %s reports for plugin '%s' %s.",
__FUNCTION__,
$timer->getMemoryLeak(),
$this->params->getPeriod()->getLabel(),
@@ -284,10 +289,12 @@ protected function shouldProcessReportsForPlugin($pluginName)
return false;
}
- if (Rules::shouldProcessReportsAllPlugins(
- array($this->params->getSite()->getId()),
- $this->params->getSegment(),
- $this->params->getPeriod()->getLabel())
+ if (
+ Rules::shouldProcessReportsAllPlugins(
+ [$this->params->getSite()->getId()],
+ $this->params->getSegment(),
+ $this->params->getPeriod()->getLabel()
+ )
) {
return true;
}
diff --git a/core/ArchiveProcessor/Rules.php b/core/ArchiveProcessor/Rules.php
index cbd3ea9cd7f..cdb091f556a 100644
--- a/core/ArchiveProcessor/Rules.php
+++ b/core/ArchiveProcessor/Rules.php
@@ -151,8 +151,10 @@ public static function getMinTimeProcessedForInProgressArchive(
// 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();
+ $minimumArchiveTime = Date::factory(Date::factory(
+ 'now',
+ $timezone
+ )->getDateStartUTC())->setTimezone($timezone)->getTimestamp();
}
}
return $minimumArchiveTime;
diff --git a/core/Changes/Model.php b/core/Changes/Model.php
index 63b79b0af85..0486e9338f8 100644
--- a/core/Changes/Model.php
+++ b/core/Changes/Model.php
@@ -102,7 +102,8 @@ public function addChange(string $pluginName, array $change): void
if(!isset($change['version']) || !isset($change['title']) || !isset($change['description'])) {
StaticContainer::get(LoggerInterface::class)->warning(
"Change item for plugin {plugin} missing version, title or description fields - ignored",
- ['plugin' => $pluginName]);
+ ['plugin' => $pluginName]
+ );
return;
}
diff --git a/core/CliMulti.php b/core/CliMulti.php
index 2b8547528c7..455600db824 100644
--- a/core/CliMulti.php
+++ b/core/CliMulti.php
@@ -207,8 +207,16 @@ private function buildCommand($hostname, $query, $outputFileIfAsync, $doEsacpeAr
$query = escapeshellarg($query);
}
- return sprintf('%s %s %s/console climulti:request -q --matomo-domain=%s %s %s %s',
- $bin, $this->phpCliOptions, PIWIK_INCLUDE_PATH, $hostname, $superuserCommand, $query, $append);
+ return sprintf(
+ '%s %s %s/console climulti:request -q --matomo-domain=%s %s %s %s',
+ $bin,
+ $this->phpCliOptions,
+ PIWIK_INCLUDE_PATH,
+ $hostname,
+ $superuserCommand,
+ $query,
+ $append
+ );
}
private function getResponse()
diff --git a/core/Concurrency/LockBackend/MySqlLockBackend.php b/core/Concurrency/LockBackend/MySqlLockBackend.php
index dd648a109b4..f47be08093a 100644
--- a/core/Concurrency/LockBackend/MySqlLockBackend.php
+++ b/core/Concurrency/LockBackend/MySqlLockBackend.php
@@ -58,9 +58,11 @@ public function setIfNotExists($key, $value, $ttlInSeconds)
Db::query($sql, array($key));
}
- $query = sprintf('INSERT INTO %s (`key`, `value`, `expiry_time`)
+ $query = sprintf(
+ 'INSERT INTO %s (`key`, `value`, `expiry_time`)
VALUES (?,?,(UNIX_TIMESTAMP() + ?))',
- $tablePrefixed);
+ $tablePrefixed
+ );
// we make sure to update the row if the key is expired and consider it as "deleted"
try {
diff --git a/core/Console.php b/core/Console.php
index e8897a0bc52..2e5a3de4a2d 100644
--- a/core/Console.php
+++ b/core/Console.php
@@ -38,7 +38,8 @@ public function __construct(Environment $environment = null)
$this->environment = $environment;
- $option = new InputOption('matomo-domain',
+ $option = new InputOption(
+ 'matomo-domain',
null,
InputOption::VALUE_OPTIONAL,
'Matomo URL (protocol and domain) eg. "http://matomo.example.org"'
@@ -46,7 +47,8 @@ public function __construct(Environment $environment = null)
$this->getDefinition()->addOption($option);
- $option = new InputOption('xhprof',
+ $option = new InputOption(
+ 'xhprof',
null,
InputOption::VALUE_NONE,
'Enable profiling with XHProf'
@@ -54,8 +56,12 @@ public function __construct(Environment $environment = null)
$this->getDefinition()->addOption($option);
- $option = new InputOption('ignore-warn', null, InputOption::VALUE_NONE,
- 'Return 0 exit code even if there are warning logs or error logs detected in the command output.');
+ $option = new InputOption(
+ 'ignore-warn',
+ null,
+ InputOption::VALUE_NONE,
+ 'Return 0 exit code even if there are warning logs or error logs detected in the command output.'
+ );
$this->getDefinition()->addOption($option);
}
diff --git a/core/CronArchive.php b/core/CronArchive.php
index d171e36d5d0..89171649b08 100644
--- a/core/CronArchive.php
+++ b/core/CronArchive.php
@@ -370,8 +370,17 @@ public function run()
$countOfProcesses = $this->getMaxConcurrentApiRequests();
- $queueConsumer = new QueueConsumer($this->logger, $this->websiteIdArchiveList, $countOfProcesses, $pid,
- $this->model, $this->segmentArchiving, $this, $this->cliMultiRequestParser, $this->archiveFilter);
+ $queueConsumer = new QueueConsumer(
+ $this->logger,
+ $this->websiteIdArchiveList,
+ $countOfProcesses,
+ $pid,
+ $this->model,
+ $this->segmentArchiving,
+ $this,
+ $this->cliMultiRequestParser,
+ $this->archiveFilter
+ );
$queueConsumer->setMaxSitesToProcess($this->maxSitesToProcess);
@@ -518,8 +527,14 @@ private function launchArchivingFor($archives, QueueConsumer $queueConsumer)
$visitsForPeriod = $this->getVisitsFromApiResponse($stats);
- $this->logArchiveJobFinished($url, $timers[$index], $visitsForPeriod,
- $archivesBeingQueried[$index]['plugin'], $archivesBeingQueried[$index]['report'], !$checkInvalid);
+ $this->logArchiveJobFinished(
+ $url,
+ $timers[$index],
+ $visitsForPeriod,
+ $archivesBeingQueried[$index]['plugin'],
+ $archivesBeingQueried[$index]['report'],
+ !$checkInvalid
+ );
$this->deleteInvalidatedArchives($archivesBeingQueried[$index]);
@@ -559,8 +574,10 @@ private function generateUrlToArchiveFromArchiveInfo($archive)
$url = $this->makeRequestUrl($url);
if (!empty($segment)) {
- $shouldSkipToday = $this->archiveFilter->isSkipSegmentsForToday() && !$this->wasSegmentChangedRecently($segment,
- $this->segmentArchiving->getAllSegments());
+ $shouldSkipToday = $this->archiveFilter->isSkipSegmentsForToday() && !$this->wasSegmentChangedRecently(
+ $segment,
+ $this->segmentArchiving->getAllSegments()
+ );
if ($shouldSkipToday) {
$url .= '&skipArchiveSegmentToday=1';
@@ -938,8 +955,14 @@ private function invalidateWithSegments($idSites, $date, $period, $_forceInvalid
if ($this->canWeSkipInvalidatingBecauseThereIsAUsablePeriod($params, $doNotIncludeTtlInExistingArchiveCheck)) {
$this->logger->debug(' Found usable archive for {archive}, skipping invalidation.', ['archive' => $params]);
} else {
- $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date, $period, $segment = false, $cascadeDown = false,
- $_forceInvalidateNonexistent);
+ $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports(
+ $idSite,
+ $date,
+ $period,
+ $segment = false,
+ $cascadeDown = false,
+ $_forceInvalidateNonexistent
+ );
}
foreach ($this->segmentArchiving->getAllSegmentsToArchive($idSite) as $segmentDefinition) {
@@ -978,8 +1001,14 @@ private function invalidateWithSegments($idSites, $date, $period, $_forceInvalid
}
}
- $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports($idSite, $date, $period, $segmentDefinition,
- $cascadeDown = false, $_forceInvalidateNonexistent);
+ $this->getApiToInvalidateArchivedReport()->invalidateArchivedReports(
+ $idSite,
+ $date,
+ $period,
+ $segmentDefinition,
+ $cascadeDown = false,
+ $_forceInvalidateNonexistent
+ );
}
}
}
diff --git a/core/CronArchive/Performance/Logger.php b/core/CronArchive/Performance/Logger.php
index e7374a3dd97..3dc89c10d62 100644
--- a/core/CronArchive/Performance/Logger.php
+++ b/core/CronArchive/Performance/Logger.php
@@ -49,10 +49,17 @@ public function logMeasurement($category, $name, ArchiveProcessor\Parameters $ac
return;
}
- $measurement = new Measurement($category, $name, $activeArchivingParams->getSite()->getId(),
- $activeArchivingParams->getPeriod()->getRangeString(), $activeArchivingParams->getPeriod()->getLabel(),
- $activeArchivingParams->getSegment()->getString(), $timer->getTime(), $timer->getMemoryLeakValue(),
- $timer->getPeakMemoryValue());
+ $measurement = new Measurement(
+ $category,
+ $name,
+ $activeArchivingParams->getSite()->getId(),
+ $activeArchivingParams->getPeriod()->getRangeString(),
+ $activeArchivingParams->getPeriod()->getLabel(),
+ $activeArchivingParams->getSegment()->getString(),
+ $timer->getTime(),
+ $timer->getMemoryLeakValue(),
+ $timer->getPeakMemoryValue()
+ );
$params = array_merge($_GET);
unset($params['pid']);
diff --git a/core/CronArchive/QueueConsumer.php b/core/CronArchive/QueueConsumer.php
index b0593cd25b5..d56bd310c77 100644
--- a/core/CronArchive/QueueConsumer.php
+++ b/core/CronArchive/QueueConsumer.php
@@ -589,7 +589,8 @@ private function getNextIdSiteToArchive()
private function getInvalidationDescription(array $invalidatedArchive)
{
- return sprintf("[idinvalidation = %s, idsite = %s, period = %s(%s - %s), name = %s, segment = %s]",
+ return sprintf(
+ "[idinvalidation = %s, idsite = %s, period = %s(%s - %s), name = %s, segment = %s]",
$invalidatedArchive['idinvalidation'],
$invalidatedArchive['idsite'],
$this->periodIdsToLabels[$invalidatedArchive['period']],
diff --git a/core/CronArchive/SegmentArchiving.php b/core/CronArchive/SegmentArchiving.php
index 87b210cdf59..26b81beb582 100644
--- a/core/CronArchive/SegmentArchiving.php
+++ b/core/CronArchive/SegmentArchiving.php
@@ -124,8 +124,10 @@ public function getReArchiveSegmentStartDate($segmentInfo)
if (empty($segmentLastEditedTime)) {
return null;
}
- $this->logger->debug("process_new_segments_from set to segment_last_edit_time, segment last edit time is {time}",
- array('time' => $segmentLastEditedTime));
+ $this->logger->debug(
+ "process_new_segments_from set to segment_last_edit_time, segment last edit time is {time}",
+ array('time' => $segmentLastEditedTime)
+ );
return $segmentLastEditedTime;
} else if (preg_match("/^editLast([0-9]+)$/", $this->processNewSegmentsFrom, $matches)) {
diff --git a/core/DataAccess/ArchiveSelector.php b/core/DataAccess/ArchiveSelector.php
index 4184954912e..93248723a9d 100644
--- a/core/DataAccess/ArchiveSelector.php
+++ b/core/DataAccess/ArchiveSelector.php
@@ -523,7 +523,10 @@ public static function querySingleBlob(array $archiveIds, string $recordName)
$chunk = new Chunk();
[$getValuesSql, $bind] = self::getSqlTemplateToFetchArchiveData(
- [$recordName], Archive::ID_SUBTABLE_LOAD_ALL_SUBTABLES, true);
+ [$recordName],
+ Archive::ID_SUBTABLE_LOAD_ALL_SUBTABLES,
+ true
+ );
$archiveIdsPerMonth = self::getArchiveIdsByYearMonth($archiveIds);
diff --git a/core/DataAccess/ArchiveWriter.php b/core/DataAccess/ArchiveWriter.php
index 49f878d43f6..92c0233f87a 100644
--- a/core/DataAccess/ArchiveWriter.php
+++ b/core/DataAccess/ArchiveWriter.php
@@ -374,8 +374,10 @@ private function checkDoneValueIsOnlyPartialForPluginArchives($doneValue)
// if the done flag is not like done%.PluginName, then it shouldn't be a partial archive.
// log a warning.
if ($doneValue == self::DONE_PARTIAL && strpos($this->doneFlag, '.') == false) {
- $ex = new \Exception(sprintf("Trying to create a partial archive w/ an all plugins done flag (done flag = %s). This should not happen.",
- $this->doneFlag));
+ $ex = new \Exception(sprintf(
+ "Trying to create a partial archive w/ an all plugins done flag (done flag = %s). This should not happen.",
+ $this->doneFlag
+ ));
StaticContainer::get(LoggerInterface::class)->warning('{exception}', [
'exception' => $ex,
]);
diff --git a/core/DataAccess/ArchivingDbAdapter.php b/core/DataAccess/ArchivingDbAdapter.php
index 5190564b9d8..f49adcca4a7 100644
--- a/core/DataAccess/ArchivingDbAdapter.php
+++ b/core/DataAccess/ArchivingDbAdapter.php
@@ -122,8 +122,10 @@ private function callFunction($function, ...$args)
$this->isErrNo($e, \Piwik\Updater\Migration\Db::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_SORT_ABORTED)
)
{
- $this->logger->warning('Archiver query exceeded maximum execution time: {details}',
- ['details' => json_encode($args, true)]);
+ $this->logger->warning(
+ 'Archiver query exceeded maximum execution time: {details}',
+ ['details' => json_encode($args, true)]
+ );
}
throw $e;
}
diff --git a/core/DataAccess/LogAggregator.php b/core/DataAccess/LogAggregator.php
index 81125af2928..12fb0697f5c 100644
--- a/core/DataAccess/LogAggregator.php
+++ b/core/DataAccess/LogAggregator.php
@@ -599,8 +599,16 @@ public function queryVisitsByDimension(
$timeLimit = -1,
$rankingQueryGenerate = false
) {
- $query = $this->getQueryByDimensionSql($dimensions, $where, $additionalSelects, $metrics, $rankingQuery, $orderBy,
- $timeLimit, $rankingQueryGenerate);
+ $query = $this->getQueryByDimensionSql(
+ $dimensions,
+ $where,
+ $additionalSelects,
+ $metrics,
+ $rankingQuery,
+ $orderBy,
+ $timeLimit,
+ $rankingQueryGenerate
+ );
// Ranking queries will return the data directly
if ($rankingQuery && !$rankingQueryGenerate) {
@@ -1244,10 +1252,13 @@ public function queryConversionsByPageView(string $linkField, int $idGoal)
];
$where = $this->getWhereStatement('log_conversion', 'server_time');
- $where .= sprintf('AND log_conversion.idgoal = %d
+ $where .= sprintf(
+ 'AND log_conversion.idgoal = %d
AND logva.server_time <= log_conversion.server_time
AND lac.type = %s',
- (int) $idGoal, ($linkField == 'idaction_url' ? Action::TYPE_PAGE_URL : Action::TYPE_PAGE_TITLE));
+ (int) $idGoal,
+ ($linkField == 'idaction_url' ? Action::TYPE_PAGE_URL : Action::TYPE_PAGE_TITLE)
+ );
$groupBy = 'log_conversion.idvisit, lac.idaction';
@@ -1268,8 +1279,8 @@ public function queryConversionsByEntryPageView(string $linkField, int $rankingQ
$tableName = self::LOG_CONVERSION_TABLE;
$select = implode(
- ', ',
- [
+ ', ',
+ [
'log_conversion.idgoal AS idgoal',
sprintf('log_visit.%s AS idaction', $linkField),
'log_action.type',
@@ -1283,7 +1294,7 @@ public function queryConversionsByEntryPageView(string $linkField, int $rankingQ
sprintf('SUM(log_conversion.items) AS `%d`', Metrics::INDEX_GOAL_ECOMMERCE_ITEMS),
sprintf('COUNT(*) AS `%d`', Metrics::INDEX_GOAL_NB_CONVERSIONS_ENTRY)
]
- );
+ );
$from = [
$tableName,
diff --git a/core/DataAccess/LogQueryBuilder/JoinGenerator.php b/core/DataAccess/LogQueryBuilder/JoinGenerator.php
index 0d24d881162..69fcdebb54e 100644
--- a/core/DataAccess/LogQueryBuilder/JoinGenerator.php
+++ b/core/DataAccess/LogQueryBuilder/JoinGenerator.php
@@ -236,10 +236,20 @@ public function findJoinCriteriasForTables(LogTable $logTable, $availableLogTabl
foreach ($availableLogTables as $availableLogTable) {
if ($logTable->getColumnToJoinOnIdVisit() && $availableLogTable->getColumnToJoinOnIdVisit()) {
- $join = sprintf("%s.%s = %s.%s", $table, $logTable->getColumnToJoinOnIdVisit(),
- $availableLogTable->getName(), $availableLogTable->getColumnToJoinOnIdVisit());
- $alternativeJoin = sprintf("%s.%s = %s.%s", $availableLogTable->getName(), $availableLogTable->getColumnToJoinOnIdVisit(),
- $table, $logTable->getColumnToJoinOnIdVisit());
+ $join = sprintf(
+ "%s.%s = %s.%s",
+ $table,
+ $logTable->getColumnToJoinOnIdVisit(),
+ $availableLogTable->getName(),
+ $availableLogTable->getColumnToJoinOnIdVisit()
+ );
+ $alternativeJoin = sprintf(
+ "%s.%s = %s.%s",
+ $availableLogTable->getName(),
+ $availableLogTable->getColumnToJoinOnIdVisit(),
+ $table,
+ $logTable->getColumnToJoinOnIdVisit()
+ );
if ($availableLogTable->shouldJoinWithSubSelect()) {
$this->joinWithSubSelect = true;
@@ -310,11 +320,21 @@ protected function generateNonVisitJoins($tableName, $tableNameToJoin, $index)
$logTable = $this->tables->getLogTable($tableName);
$logTableToJoin = $this->tables->getLogTable($tableNameToJoin);
- $nonVisitJoin = sprintf("%s.%s = %s.%s", $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction(),
- $tableName, $logTable->getColumnToJoinOnIdAction());
-
- $altNonVisitJoin = sprintf("%s.%s = %s.%s", $tableName, $logTable->getColumnToJoinOnIdAction(),
- $logTableToJoin->getName(), $logTableToJoin->getColumnToJoinOnIdAction());
+ $nonVisitJoin = sprintf(
+ "%s.%s = %s.%s",
+ $logTableToJoin->getName(),
+ $logTableToJoin->getColumnToJoinOnIdAction(),
+ $tableName,
+ $logTable->getColumnToJoinOnIdAction()
+ );
+
+ $altNonVisitJoin = sprintf(
+ "%s.%s = %s.%s",
+ $tableName,
+ $logTable->getColumnToJoinOnIdAction(),
+ $logTableToJoin->getName(),
+ $logTableToJoin->getColumnToJoinOnIdAction()
+ );
if ($index > 0
&& $this->tables->hasAddedTableManually($tableName)
diff --git a/core/DataAccess/Model.php b/core/DataAccess/Model.php
index e859e2599f5..f9be680b0f8 100644
--- a/core/DataAccess/Model.php
+++ b/core/DataAccess/Model.php
@@ -531,7 +531,8 @@ public function allocateNewArchiveId($numericTable)
public function updateArchiveStatus($numericTable, $archiveId, $doneFlag, $value)
{
- Db::query("UPDATE $numericTable SET `value` = ? WHERE idarchive = ? and `name` = ?",
+ Db::query(
+ "UPDATE $numericTable SET `value` = ? WHERE idarchive = ? and `name` = ?",
array($value, $archiveId, $doneFlag)
);
}
diff --git a/core/DataTable.php b/core/DataTable.php
index 05d2ca2686b..fac883bbdaf 100644
--- a/core/DataTable.php
+++ b/core/DataTable.php
@@ -835,7 +835,10 @@ public function addRow(Row $row)
$this->addSummaryRow(new Row(array(Row::COLUMNS => $columns)));
} else {
$this->summaryRow->sumRow(
- $row, $enableCopyMetadata = false, $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME));
+ $row,
+ $enableCopyMetadata = false,
+ $this->getMetadata(self::COLUMN_AGGREGATION_OPS_METADATA_NAME)
+ );
}
return $this->summaryRow;
}
@@ -1353,7 +1356,8 @@ public function getSerialized(
}
if (!is_null($maximumRowsInDataTable)) {
- $this->filter('Truncate',
+ $this->filter(
+ 'Truncate',
array($maximumRowsInDataTable - 1,
DataTable::LABEL_SUMMARY_ROW,
$columnToSortByBeforeTruncation,
@@ -1984,7 +1988,8 @@ protected function aggregateRowWithLabel(Row $row, $columnAggregationOps)
{
$labelToLookFor = $row->getColumn('label');
if ($labelToLookFor === false) {
- $message = sprintf("Label column not found in the table to add in addDataTable(). Row: %s",
+ $message = sprintf(
+ "Label column not found in the table to add in addDataTable(). Row: %s",
var_export($row->getColumns(), 1)
);
throw new Exception($message);
diff --git a/core/DataTable/Filter/CalculateEvolutionFilter.php b/core/DataTable/Filter/CalculateEvolutionFilter.php
index 5906e1bb8fd..ea0e9f763c2 100644
--- a/core/DataTable/Filter/CalculateEvolutionFilter.php
+++ b/core/DataTable/Filter/CalculateEvolutionFilter.php
@@ -57,7 +57,13 @@ class CalculateEvolutionFilter extends ColumnCallbackAddColumnPercentage
public function __construct($table, $pastDataTable, $columnToAdd, $columnToRead, $quotientPrecision = 0)
{
parent::__construct(
- $table, $columnToAdd, $columnToRead, $columnToRead, $quotientPrecision, $shouldSkipRows = true);
+ $table,
+ $columnToAdd,
+ $columnToRead,
+ $columnToRead,
+ $quotientPrecision,
+ $shouldSkipRows = true
+ );
$this->pastDataTable = $pastDataTable;
diff --git a/core/DataTable/Filter/PivotByDimension.php b/core/DataTable/Filter/PivotByDimension.php
index 125c248abbe..a79cdc258ec 100644
--- a/core/DataTable/Filter/PivotByDimension.php
+++ b/core/DataTable/Filter/PivotByDimension.php
@@ -160,9 +160,16 @@ public function __construct(
) {
parent::__construct($table);
- Log::debug("PivotByDimension::%s: creating with [report = %s, pivotByDimension = %s, pivotColumn = %s, "
- . "pivotByColumnLimit = %s, isFetchingBySegmentEnabled = %s]", __FUNCTION__, $report, $pivotByDimension,
- $pivotColumn, $pivotByColumnLimit, $isFetchingBySegmentEnabled);
+ Log::debug(
+ "PivotByDimension::%s: creating with [report = %s, pivotByDimension = %s, pivotColumn = %s, "
+ . "pivotByColumnLimit = %s, isFetchingBySegmentEnabled = %s]",
+ __FUNCTION__,
+ $report,
+ $pivotByDimension,
+ $pivotColumn,
+ $pivotByColumnLimit,
+ $isFetchingBySegmentEnabled
+ );
$this->pivotByColumnLimit = $pivotByColumnLimit ?: self::getDefaultColumnLimit();
$this->isFetchingBySegmentEnabled = $isFetchingBySegmentEnabled;
diff --git a/core/DataTable/Row.php b/core/DataTable/Row.php
index b85e9afbed1..bb8dc8e4cab 100644
--- a/core/DataTable/Row.php
+++ b/core/DataTable/Row.php
@@ -584,9 +584,11 @@ public function sumRowMetadata($rowToSum, $aggregationOperations = array())
}
// We shall update metadata, and keep the metadata with the _most visits or pageviews_, rather than first or last seen
- $visits = max($rowToSum->getColumn(Metrics::INDEX_PAGE_NB_HITS) || $rowToSum->getColumn(Metrics::INDEX_NB_VISITS),
+ $visits = max(
+ $rowToSum->getColumn(Metrics::INDEX_PAGE_NB_HITS) || $rowToSum->getColumn(Metrics::INDEX_NB_VISITS),
// Old format pre-1.2, @see also method doSumVisitsMetrics()
- $rowToSum->getColumn('nb_actions') || $rowToSum->getColumn('nb_visits'));
+ $rowToSum->getColumn('nb_actions') || $rowToSum->getColumn('nb_visits')
+ );
if (($visits && $visits > $this->maxVisitsSummed)
|| empty($this->metadata)
) {
@@ -663,8 +665,13 @@ protected function sumRowArray($thisColumnValue, $columnToSumValue, $columnName
$label = $this->getColumn('label');
$thisColumnDescription = $this->getColumnValueDescriptionForError($thisColumnValue);
$columnToSumValueDescription = $this->getColumnValueDescriptionForError($columnToSumValue);
- throw new \Exception(sprintf('Trying to sum unsupported operands for column %s in row with label = %s: %s + %s',
- $columnName, $label, $thisColumnDescription, $columnToSumValueDescription));
+ throw new \Exception(sprintf(
+ 'Trying to sum unsupported operands for column %s in row with label = %s: %s + %s',
+ $columnName,
+ $label,
+ $thisColumnDescription,
+ $columnToSumValueDescription
+ ));
}
return $thisColumnValue + $columnToSumValue;