From bdb37ef8d12226811163ace593679b45861c7def Mon Sep 17 00:00:00 2001 From: sgiehl Date: Tue, 13 Feb 2024 18:04:46 +0100 Subject: [PATCH] Apply coding style around FunctionCallSignature #3 --- core/Tracker/TrackerCodeGenerator.php | 13 ++- core/Tracker/Visit.php | 9 +- core/Translation/Weblate/API.php | 21 ++++- core/Twig.php | 3 +- core/Updater.php | 8 +- core/Updater/Migration/Db/CreateTable.php | 10 ++- core/Updates/0.9.1.php | 6 +- core/Updates/1.2.3.php | 2 +- core/Updates/1.2.5-rc1.php | 4 +- core/Updates/1.8.4-b1.php | 40 +++++---- core/Updates/2.1.1-b11.php | 4 +- core/Updates/3.0.0-b1.php | 6 +- core/Updates/3.13.1-b2.php | 12 ++- core/Updates/3.6.0-b2.php | 7 +- core/Updates/3.8.0-b4.php | 6 +- core/Updates/4.0.0-rc4.php | 4 +- core/Updates/4.7.0-b2.php | 7 +- core/Updates/5.0.0-b1.php | 3 +- core/UrlHelper.php | 3 +- plugins/API/API.php | 40 +++++++-- plugins/API/Filter/DataComparisonFilter.php | 4 +- .../ComparisonRowGenerator.php | 6 +- plugins/API/Glossary.php | 10 ++- plugins/API/Menu.php | 6 +- plugins/API/ProcessedReport.php | 13 ++- plugins/API/RowEvolution.php | 19 +++- plugins/Actions/ArchivingHelper.php | 11 ++- .../Actions/RecordBuilders/ActionReports.php | 87 ++++++++++++++++--- .../Tracker/ActionsRequestProcessor.php | 14 ++- plugins/Actions/VisitorDetails.php | 6 +- 30 files changed, 292 insertions(+), 92 deletions(-) diff --git a/core/Tracker/TrackerCodeGenerator.php b/core/Tracker/TrackerCodeGenerator.php index 845b7faa932..4a02ddf81ec 100644 --- a/core/Tracker/TrackerCodeGenerator.php +++ b/core/Tracker/TrackerCodeGenerator.php @@ -182,9 +182,16 @@ public function generate( $codeImpl['protocol'] = 'https://'; } - $parameters = compact('mergeSubdomains', 'groupPageTitlesByDomain', 'mergeAliasUrls', 'visitorCustomVariables', - 'pageCustomVariables', 'customCampaignNameQueryParam', 'customCampaignKeywordParam', - 'doNotTrack'); + $parameters = compact( + 'mergeSubdomains', + 'groupPageTitlesByDomain', + 'mergeAliasUrls', + 'visitorCustomVariables', + 'pageCustomVariables', + 'customCampaignNameQueryParam', + 'customCampaignKeywordParam', + 'doNotTrack' + ); /** * Triggered when generating JavaScript tracking code server side. Plugins can use diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index 0e329058110..15fa3a5fae1 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -445,7 +445,8 @@ protected function updateExistingVisit($valuesToUpdate) throw new VisitorNotFoundInDb( "The visitor with idvisitor=" . bin2hex($this->visitProperties->getProperty('idvisitor')) . " and idvisit=" . @$this->visitProperties->getProperty('idvisit') - . " wasn't found in the DB, we fallback to a new visitor"); + . " wasn't found in the DB, we fallback to a new visitor" + ); } } @@ -557,8 +558,10 @@ protected function getAllVisitDimensions() $dimensionNames[] = $dimension->getColumnName(); } - Common::printDebug("Following dimensions have been collected from plugins: " . implode(", ", - $dimensionNames)); + Common::printDebug("Following dimensions have been collected from plugins: " . implode( + ", ", + $dimensionNames + )); } return self::$dimensions; diff --git a/core/Translation/Weblate/API.php b/core/Translation/Weblate/API.php index dad14ee6aca..2a0e9da167a 100644 --- a/core/Translation/Weblate/API.php +++ b/core/Translation/Weblate/API.php @@ -130,9 +130,24 @@ protected function getApiResults($apiPath, $raw = false) { $apiUrl = $this->apiUrl . $apiPath; - $response = Http::sendHttpRequestBy(Http::getTransportMethod(), $apiUrl, 60, null, null, null, 5, false, - false, false, true, 'GET', null, null, null, - ['Authorization: Token ' . $this->apiToken]); + $response = Http::sendHttpRequestBy( + Http::getTransportMethod(), + $apiUrl, + 60, + null, + null, + null, + 5, + false, + false, + false, + true, + 'GET', + null, + null, + null, + ['Authorization: Token ' . $this->apiToken] + ); $httpStatus = $response['status']; $response = $response['data']; diff --git a/core/Twig.php b/core/Twig.php index 9f2561ef83e..8f61ff7dc6c 100644 --- a/core/Twig.php +++ b/core/Twig.php @@ -108,7 +108,8 @@ public function __construct() // Create new Twig Environment and set cache dir $cache = StaticContainer::get('twig.cache'); - $this->twig = new Environment($chainLoader, + $this->twig = new Environment( + $chainLoader, array( 'debug' => true, // to use {{ dump(var) }} in twig templates 'strict_variables' => true, // throw an exception if variables are invalid diff --git a/core/Updater.php b/core/Updater.php index 28ca96f1ac0..39991bdc6ef 100644 --- a/core/Updater.php +++ b/core/Updater.php @@ -590,8 +590,12 @@ public function executeMigration($file, Migration $migration) $migration->exec(); } catch (\Exception $e) { if (!$migration->shouldIgnoreError($e)) { - $message = sprintf("%s:\nError trying to execute the migration '%s'.\nThe error was: %s", - $file, $migration->__toString(), $e->getMessage()); + $message = sprintf( + "%s:\nError trying to execute the migration '%s'.\nThe error was: %s", + $file, + $migration->__toString(), + $e->getMessage() + ); throw new UpdaterErrorException($message); } } diff --git a/core/Updater/Migration/Db/CreateTable.php b/core/Updater/Migration/Db/CreateTable.php index 70f6f3bddbf..29afa9f102d 100644 --- a/core/Updater/Migration/Db/CreateTable.php +++ b/core/Updater/Migration/Db/CreateTable.php @@ -35,8 +35,14 @@ public function __construct(Db\Settings $dbSettings, $table, $columnNames, $prim } - $sql = rtrim(sprintf('CREATE TABLE `%s` (%s) ENGINE=%s DEFAULT CHARSET=%s %s', - $table, implode(', ', $columns), $dbSettings->getEngine(), $dbSettings->getUsedCharset(), $dbSettings->getRowFormat())); + $sql = rtrim(sprintf( + 'CREATE TABLE `%s` (%s) ENGINE=%s DEFAULT CHARSET=%s %s', + $table, + implode(', ', $columns), + $dbSettings->getEngine(), + $dbSettings->getUsedCharset(), + $dbSettings->getRowFormat() + )); parent::__construct($sql, static::ERROR_CODE_TABLE_EXISTS); } diff --git a/core/Updates/0.9.1.php b/core/Updates/0.9.1.php index 024706b1a83..6b231ed783f 100644 --- a/core/Updates/0.9.1.php +++ b/core/Updates/0.9.1.php @@ -50,11 +50,13 @@ public function getMigrations(Updater $updater) return array( $this->migration->db->sql( 'UPDATE ' . Common::prefixTable('site') . ' - SET timezone = "UTC" WHERE timezone IN (' . $timezoneList . ')'), + SET timezone = "UTC" WHERE timezone IN (' . $timezoneList . ')' + ), $this->migration->db->sql( 'UPDATE `' . Common::prefixTable('option') . '` - SET option_value = "UTC" WHERE option_name = "SitesManager_DefaultTimezone" AND option_value IN (' . $timezoneList . ')'), + SET option_value = "UTC" WHERE option_name = "SitesManager_DefaultTimezone" AND option_value IN (' . $timezoneList . ')' + ), ); } diff --git a/core/Updates/1.2.3.php b/core/Updates/1.2.3.php index 6ed5359bbbe..bde19f52347 100644 --- a/core/Updates/1.2.3.php +++ b/core/Updates/1.2.3.php @@ -40,7 +40,7 @@ public function getMigrations(Updater $updater) // Various performance improvements schema updates $this->migration->db->sql( - 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` + 'ALTER TABLE `' . Common::prefixTable('log_visit') . '` DROP INDEX index_idsite_datetime_config, DROP INDEX index_idsite_idvisit, ADD INDEX index_idsite_config_datetime (idsite, config_id, visit_last_action_time), diff --git a/core/Updates/1.2.5-rc1.php b/core/Updates/1.2.5-rc1.php index c1c1e679cbd..c5b9fab1614 100644 --- a/core/Updates/1.2.5-rc1.php +++ b/core/Updates/1.2.5-rc1.php @@ -36,7 +36,9 @@ public function getMigrations(Updater $updater) 'ALTER TABLE `' . Common::prefixTable('log_conversion') . '` ADD buster int unsigned NOT NULL AFTER revenue, DROP PRIMARY KEY, - ADD PRIMARY KEY (idvisit, idgoal, buster)', Updater\Migration\Db::ERROR_CODE_DUPLICATE_COLUMN), + ADD PRIMARY KEY (idvisit, idgoal, buster)', + Updater\Migration\Db::ERROR_CODE_DUPLICATE_COLUMN + ), ); } diff --git a/core/Updates/1.8.4-b1.php b/core/Updates/1.8.4-b1.php index 52a7503d940..d3ca6fa29ed 100644 --- a/core/Updates/1.8.4-b1.php +++ b/core/Updates/1.8.4-b1.php @@ -47,7 +47,7 @@ public function getMigrations(Updater $updater) // remove protocol and www and store information in url_prefix $this->migration->db->sql( - " UPDATE `$action` + " UPDATE `$action` SET url_prefix = IF ( LEFT(name, 11) = 'http://www.', 1, IF ( @@ -71,7 +71,8 @@ public function getMigrations(Updater $updater) WHERE type = 1 AND url_prefix IS NULL; - "), + " + ), $this->migration->db->dropTable('log_action_duplicates'), $this->migration->db->createTable('log_action_duplicates', array( 'before' => 'int(10) unsigned NOT NULL', @@ -82,7 +83,7 @@ public function getMigrations(Updater $updater) // grouping by name only would be case-insensitive, so we GROUP BY name,hash // ON (action.type = 1 AND canonical.hash = action.hash) will use index (type, hash) $this->migration->db->sql( - " INSERT INTO `$duplicates` ( + " INSERT INTO `$duplicates` ( SELECT action.idaction AS `before`, canonical.idaction AS `after` @@ -107,11 +108,12 @@ public function getMigrations(Updater $updater) AND canonical.name = action.name AND canonical.idaction != action.idaction ); - "), + " + ), // replace idaction in log_link_visit_action $this->migration->db->sql( - " UPDATE + " UPDATE `$visitAction` AS link LEFT JOIN `$duplicates` AS duplicates_idaction_url @@ -120,9 +122,10 @@ public function getMigrations(Updater $updater) link.idaction_url = duplicates_idaction_url.after WHERE duplicates_idaction_url.after IS NOT NULL; - "), + " + ), $this->migration->db->sql( - " UPDATE + " UPDATE `$visitAction` AS link LEFT JOIN `$duplicates` AS duplicates_idaction_url_ref @@ -131,11 +134,12 @@ public function getMigrations(Updater $updater) link.idaction_url_ref = duplicates_idaction_url_ref.after WHERE duplicates_idaction_url_ref.after IS NOT NULL; - "), + " + ), // replace idaction in log_conversion $this->migration->db->sql( - " UPDATE + " UPDATE `$conversion` AS conversion LEFT JOIN `$duplicates` AS duplicates @@ -144,11 +148,12 @@ public function getMigrations(Updater $updater) conversion.idaction_url = duplicates.after WHERE duplicates.after IS NOT NULL; - "), + " + ), // replace idaction in log_visit $this->migration->db->sql( - " UPDATE + " UPDATE `$visit` AS visit LEFT JOIN `$duplicates` AS duplicates_entry @@ -157,9 +162,10 @@ public function getMigrations(Updater $updater) visit.visit_entry_idaction_url = duplicates_entry.after WHERE duplicates_entry.after IS NOT NULL; - "), + " + ), $this->migration->db->sql( - " UPDATE + " UPDATE `$visit` AS visit LEFT JOIN `$duplicates` AS duplicates_exit @@ -168,18 +174,20 @@ public function getMigrations(Updater $updater) visit.visit_exit_idaction_url = duplicates_exit.after WHERE duplicates_exit.after IS NOT NULL; - "), + " + ), // remove duplicates from log_action $this->migration->db->sql( - " DELETE action FROM + " DELETE action FROM `$action` AS action LEFT JOIN `$duplicates` AS duplicates ON action.idaction = duplicates.before WHERE duplicates.after IS NOT NULL; - "), + " + ), // remove the duplicates table $this->migration->db->dropTable('log_action_duplicates') diff --git a/core/Updates/2.1.1-b11.php b/core/Updates/2.1.1-b11.php index aaadc499d44..3ee09b506d3 100644 --- a/core/Updates/2.1.1-b11.php +++ b/core/Updates/2.1.1-b11.php @@ -61,7 +61,9 @@ public function doUpdate(Updater $updater) $sql = "SELECT idarchive, idsite, period, date1, date2 FROM $table WHERE name = ? GROUP BY idarchive"; $visitSummaryReturningSegmentDone = Rules::getDoneFlagArchiveContainsOnePlugin( - new Segment(VisitFrequencyApi::RETURNING_VISITOR_SEGMENT, $idSites = array()), 'VisitsSummary'); + new Segment(VisitFrequencyApi::RETURNING_VISITOR_SEGMENT, $idSites = array()), + 'VisitsSummary' + ); $idArchivesWithVisitReturningSegment = Db::fetchAll($sql, array($visitSummaryReturningSegmentDone)); // collect info for new visitssummary archives have to be created to match archives w/ *._returning diff --git a/core/Updates/3.0.0-b1.php b/core/Updates/3.0.0-b1.php index 02ae9653106..0f1b44ffdec 100644 --- a/core/Updates/3.0.0-b1.php +++ b/core/Updates/3.0.0-b1.php @@ -177,8 +177,10 @@ private function getSiteSettingsMigrations($queries) )); $table = Common::prefixTable($table); - $queries[] = $this->migration->db->sql("ALTER TABLE `$table` ADD INDEX(idsite, plugin_name);", - Migration\Db::ERROR_CODE_COLUMN_NOT_EXISTS); + $queries[] = $this->migration->db->sql( + "ALTER TABLE `$table` ADD INDEX(idsite, plugin_name);", + Migration\Db::ERROR_CODE_COLUMN_NOT_EXISTS + ); return $queries; } diff --git a/core/Updates/3.13.1-b2.php b/core/Updates/3.13.1-b2.php index e2bc0517af2..d51333ca8ce 100644 --- a/core/Updates/3.13.1-b2.php +++ b/core/Updates/3.13.1-b2.php @@ -37,10 +37,14 @@ public function getMigrations(Updater $updater) { $geoIpLiteUrl = 'https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz'; $optionTable = Common::prefixTable('option'); - $migration1 = $this->migration->db->boundSql("UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", - [GeoIp2::getDbIpLiteUrl(), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, $geoIpLiteUrl]); - $migration2 = $this->migration->db->boundSql("UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", - [GeoIp2::getDbIpLiteUrl('country'), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, self::GEO_LITE_COUNTRY_URL]); + $migration1 = $this->migration->db->boundSql( + "UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", + [GeoIp2::getDbIpLiteUrl(), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, $geoIpLiteUrl] + ); + $migration2 = $this->migration->db->boundSql( + "UPDATE `$optionTable` SET option_value = ? WHERE option_name = ? AND option_value = ?", + [GeoIp2::getDbIpLiteUrl('country'), GeoIP2AutoUpdater::LOC_URL_OPTION_NAME, self::GEO_LITE_COUNTRY_URL] + ); return [$migration1, $migration2]; } diff --git a/core/Updates/3.6.0-b2.php b/core/Updates/3.6.0-b2.php index e385db072a2..3aa384b8baf 100644 --- a/core/Updates/3.6.0-b2.php +++ b/core/Updates/3.6.0-b2.php @@ -69,8 +69,11 @@ public function getMigrations(Updater $updater) } // changes for session auth - $migrations[] = $this->migration->db->addColumn('user', 'ts_password_modified', - 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP'); + $migrations[] = $this->migration->db->addColumn( + 'user', + 'ts_password_modified', + 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP' + ); return $migrations; } diff --git a/core/Updates/3.8.0-b4.php b/core/Updates/3.8.0-b4.php index dca57352071..5c021f382e8 100644 --- a/core/Updates/3.8.0-b4.php +++ b/core/Updates/3.8.0-b4.php @@ -27,12 +27,14 @@ public function __construct(MigrationFactory $factory) public function getMigrations(Updater $updater) { - $trackingFailureTable = $this->migration->db->createTable('tracking_failure', + $trackingFailureTable = $this->migration->db->createTable( + 'tracking_failure', array('idsite' => 'BIGINT(20) UNSIGNED NOT NULL', 'idfailure' => 'SMALLINT UNSIGNED NOT NULL', 'date_first_occurred' => 'DATETIME NOT NULL', 'request_url' => 'MEDIUMTEXT NOT NULL'), - array('idsite', 'idfailure')); + array('idsite', 'idfailure') + ); $columns = array( 'id_brute_force_log' => 'bigint(11) NOT NULL AUTO_INCREMENT', diff --git a/core/Updates/4.0.0-rc4.php b/core/Updates/4.0.0-rc4.php index ee0bd4e4c7b..f4a2c25cb4b 100644 --- a/core/Updates/4.0.0-rc4.php +++ b/core/Updates/4.0.0-rc4.php @@ -51,7 +51,9 @@ public function getMigrations(Updater $updater) if (DbHelper::tableExists($blobTable) && DbHelper::tableExists($numericTable)) { $migrations[] = $this->migration->db->sql( - "DELETE FROM `$blobTable` WHERE idarchive NOT IN (SELECT idarchive FROM `$numericTable`)", []); + "DELETE FROM `$blobTable` WHERE idarchive NOT IN (SELECT idarchive FROM `$numericTable`)", + [] + ); } } } diff --git a/core/Updates/4.7.0-b2.php b/core/Updates/4.7.0-b2.php index 6442acd1cf6..538d5e38329 100644 --- a/core/Updates/4.7.0-b2.php +++ b/core/Updates/4.7.0-b2.php @@ -42,8 +42,11 @@ public function getMigrations(Updater $updater) $migrations = []; // add column to track the last change a user viewed the changes list - $migrations[] = $this->migration->db->addColumn('user', 'idchange_last_viewed', - 'INTEGER UNSIGNED NULL'); + $migrations[] = $this->migration->db->addColumn( + 'user', + 'idchange_last_viewed', + 'INTEGER UNSIGNED NULL' + ); $migrations[] = $this->migration->db->createTable('changes', array( 'idchange' => 'INT(11) NOT NULL AUTO_INCREMENT', diff --git a/core/Updates/5.0.0-b1.php b/core/Updates/5.0.0-b1.php index debbb22aee2..83e6fe8007f 100644 --- a/core/Updates/5.0.0-b1.php +++ b/core/Updates/5.0.0-b1.php @@ -96,7 +96,8 @@ private function appendLogVisitTableMigrations($migrations) // already existing index has the correct fields. Try renaming, but ignore syntax error thrown if rename command does not exist $migrations[] = $this->migration->db->sql( "ALTER TABLE `{$this->tableName}` RENAME INDEX `{$this->indexName}` TO `{$this->newIndexName}`", - [DbAlias::ERROR_CODE_SYNTAX_ERROR]); + [DbAlias::ERROR_CODE_SYNTAX_ERROR] + ); } // create the new index if it does not yet exist and drop the old one diff --git a/core/UrlHelper.php b/core/UrlHelper.php index 0e1fdfbab8f..4f80b0b0306 100644 --- a/core/UrlHelper.php +++ b/core/UrlHelper.php @@ -127,7 +127,8 @@ public static function getLossyUrl($url) '.{}$4', '$1{}.', ), - $url); + $url + ); } /** diff --git a/plugins/API/API.php b/plugins/API/API.php index 0a21c060503..b8699440b67 100644 --- a/plugins/API/API.php +++ b/plugins/API/API.php @@ -304,8 +304,23 @@ public function getProcessedReport( ) { Piwik::checkUserHasViewAccess($idSite); - $processed = $this->processedReport->getProcessedReport($idSite, $period, $date, $apiModule, $apiAction, $segment, - $apiParameters, $idGoal, $language, $showTimer, $hideMetricsDoc, $idSubtable, $showRawMetrics, $format_metrics, $idDimension); + $processed = $this->processedReport->getProcessedReport( + $idSite, + $period, + $date, + $apiModule, + $apiAction, + $segment, + $apiParameters, + $idGoal, + $language, + $showTimer, + $hideMetricsDoc, + $idSubtable, + $showRawMetrics, + $format_metrics, + $idDimension + ); return $processed; } @@ -464,8 +479,22 @@ public function getRowEvolution($idSite, $period, $date, $apiModule, $apiAction, } $rowEvolution = new RowEvolution(); - return $rowEvolution->getRowEvolution($idSite, $period, $date, $apiModule, $apiAction, $label, $segment, $column, - $language, $apiParameters, $legendAppendMetric, $labelUseAbsoluteUrl, $labelSeries, $showGoalMetricsForGoal); + return $rowEvolution->getRowEvolution( + $idSite, + $period, + $date, + $apiModule, + $apiAction, + $label, + $segment, + $column, + $language, + $apiParameters, + $legendAppendMetric, + $labelUseAbsoluteUrl, + $labelSeries, + $showGoalMetricsForGoal + ); } /** @@ -592,7 +621,8 @@ public function getSuggestedValuesForSegment($segmentName, $idSite) if (isset($segment['suggestedValuesCallback'])) { $suggestedValuesCallbackRequiresTable = $this->doesSuggestedValuesCallbackNeedData( - $segment['suggestedValuesCallback']); + $segment['suggestedValuesCallback'] + ); if (!$suggestedValuesCallbackRequiresTable) { return call_user_func($segment['suggestedValuesCallback'], $idSite, $maxSuggestionsToReturn); diff --git a/plugins/API/Filter/DataComparisonFilter.php b/plugins/API/Filter/DataComparisonFilter.php index e0bcca7d78d..3d8a8a56063 100644 --- a/plugins/API/Filter/DataComparisonFilter.php +++ b/plugins/API/Filter/DataComparisonFilter.php @@ -401,7 +401,9 @@ private function getMetadataFromModifiedParams($modifiedParams) $metadata['comparePeriodPretty'] = ucfirst($prettyPeriod); $metadata['compareSeriesPretty'] = self::getComparisonSeriesLabelSuffixFromParts( - $metadata['comparePeriodPretty'], $metadata['compareSegmentPretty']); + $metadata['comparePeriodPretty'], + $metadata['compareSegmentPretty'] + ); return $metadata; } diff --git a/plugins/API/Filter/DataComparisonFilter/ComparisonRowGenerator.php b/plugins/API/Filter/DataComparisonFilter/ComparisonRowGenerator.php index fb81154509d..881bbeedf87 100644 --- a/plugins/API/Filter/DataComparisonFilter/ComparisonRowGenerator.php +++ b/plugins/API/Filter/DataComparisonFilter/ComparisonRowGenerator.php @@ -136,8 +136,10 @@ private function compareRow(DataTable $table, $compareMetadata, DataTable\Row $r $comparisonDataTable = $row->getComparisons(); if (empty($comparisonDataTable)) { $comparisonDataTable = new DataTable(); - $comparisonDataTable->setMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, - $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME)); + $comparisonDataTable->setMetadata( + DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME, + $table->getMetadata(DataTable::EXTRA_PROCESSED_METRICS_METADATA_NAME) + ); $row->setComparisons($comparisonDataTable); } diff --git a/plugins/API/Glossary.php b/plugins/API/Glossary.php index 2c6d71ab856..d612ae3ca4d 100644 --- a/plugins/API/Glossary.php +++ b/plugins/API/Glossary.php @@ -85,10 +85,12 @@ public function metricsGlossary($idSite) $metricKey = $metricName; if (isset($metrics[$metricKey]) && $metrics[$metricKey]['documentation'] !== $metricDocumentation) { - throw new \Exception(sprintf("Metric %s has two different documentations: \n(1) %s \n(2) %s", - $metricKey, - $metrics[$metricKey]['documentation'], - $metricDocumentation)); + throw new \Exception(sprintf( + "Metric %s has two different documentations: \n(1) %s \n(2) %s", + $metricKey, + $metrics[$metricKey]['documentation'], + $metricDocumentation + )); } } else { diff --git a/plugins/API/Menu.php b/plugins/API/Menu.php index b2ec5b1ead7..7167f803e2f 100644 --- a/plugins/API/Menu.php +++ b/plugins/API/Menu.php @@ -27,14 +27,16 @@ public function configureTopMenu(MenuTop $menu) public function configureAdminMenu(MenuAdmin $menu) { - $menu->addPlatformItem('General_API', + $menu->addPlatformItem( + 'General_API', $this->urlForAction('listAllAPI', array('segment' => false)), 7, Piwik::translate('API_TopLinkTooltip') ); if(Piwik::isUserIsAnonymous()) { - $menu->addPlatformItem('API_Glossary', + $menu->addPlatformItem( + 'API_Glossary', $this->urlForAction('glossary', array('segment' => false)), 50 ); diff --git a/plugins/API/ProcessedReport.php b/plugins/API/ProcessedReport.php index f2525d0575b..910bc4bf136 100644 --- a/plugins/API/ProcessedReport.php +++ b/plugins/API/ProcessedReport.php @@ -366,8 +366,17 @@ public function getProcessedReport( } // Is this report found in the Metadata available reports? - $reportMetadata = $this->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, - $period, $date, $hideMetricsDoc, $showSubtableReports = true); + $reportMetadata = $this->getMetadata( + $idSite, + $apiModule, + $apiAction, + $apiParameters, + $language, + $period, + $date, + $hideMetricsDoc, + $showSubtableReports = true + ); if (empty($reportMetadata)) { throw new Exception("Requested report $apiModule.$apiAction for Website id=$idSite not found in the list of available reports. \n"); } diff --git a/plugins/API/RowEvolution.php b/plugins/API/RowEvolution.php index 497f7a1a8bd..05a47a5b383 100644 --- a/plugins/API/RowEvolution.php +++ b/plugins/API/RowEvolution.php @@ -426,8 +426,17 @@ private function loadRowEvolutionDataFromAPI($metadata, $idSite, $period, $date, */ private function getRowEvolutionMetaData($idSite, $period, $date, $apiModule, $apiAction, $language, $apiParameters) { - $reportMetadata = API::getInstance()->getMetadata($idSite, $apiModule, $apiAction, $apiParameters, $language, - $period, $date, $hideMetricsDoc = false, $showSubtableReports = true); + $reportMetadata = API::getInstance()->getMetadata( + $idSite, + $apiModule, + $apiAction, + $apiParameters, + $language, + $period, + $date, + $hideMetricsDoc = false, + $showSubtableReports = true + ); if (empty($reportMetadata)) { throw new Exception("Requested report $apiModule.$apiAction for Website id=$idSite " @@ -558,7 +567,11 @@ private function getMultiRowEvolution( if ($labelRow) { $actualLabels[$labelIdx] = $this->getRowUrlForEvolutionLabel( - $labelRow, $apiModule, $apiAction, $labelUseAbsoluteUrl); + $labelRow, + $apiModule, + $apiAction, + $labelUseAbsoluteUrl + ); $prettyLabel = $labelRow->getColumn('label_html'); if ($prettyLabel !== false) { diff --git a/plugins/Actions/ArchivingHelper.php b/plugins/Actions/ArchivingHelper.php index 26b53c1c672..9f2d7146065 100644 --- a/plugins/Actions/ArchivingHelper.php +++ b/plugins/Actions/ArchivingHelper.php @@ -289,7 +289,8 @@ private static function updateActionsTableRowWithGoals(array $row, bool $isPages $row[PiwikMetrics::INDEX_GOAL_NB_CONVERSIONS_ENTRY_RATE] = Piwik::getQuotientSafe( $conversions, $nbEntrances, - GoalManager::REVENUE_PRECISION + 1); + GoalManager::REVENUE_PRECISION + 1 + ); } // Calculate revenue per entry @@ -297,7 +298,8 @@ private static function updateActionsTableRowWithGoals(array $row, bool $isPages $row[PiwikMetrics::INDEX_GOAL_REVENUE_PER_ENTRY] = (float) Piwik::getQuotientSafe( $row[PiwikMetrics::INDEX_GOAL_REVENUE_ENTRY], $nbEntrances, - GoalManager::REVENUE_PRECISION + 1); + GoalManager::REVENUE_PRECISION + 1 + ); $row[PiwikMetrics::INDEX_GOAL_REVENUE_ENTRY] = (float) $row[PiwikMetrics::INDEX_GOAL_REVENUE_ENTRY]; } @@ -544,7 +546,10 @@ public static function getActionRow($actionName, $actionType, $urlPrefix, $actio // go to the level of the subcategory $actionExplodedNames = self::getActionExplodedNames($actionName, $actionType, $urlPrefix); list($row, $level) = $currentTable->walkPath( - $actionExplodedNames, self::getDefaultRowColumns(), self::$maximumRowsInSubDataTable); + $actionExplodedNames, + self::getDefaultRowColumns(), + self::$maximumRowsInSubDataTable + ); return $row; } diff --git a/plugins/Actions/RecordBuilders/ActionReports.php b/plugins/Actions/RecordBuilders/ActionReports.php index 86692077ca1..a7ca7887fad 100644 --- a/plugins/Actions/RecordBuilders/ActionReports.php +++ b/plugins/Actions/RecordBuilders/ActionReports.php @@ -77,8 +77,13 @@ protected function aggregate(ArchiveProcessor $archiveProcessor): array $tablesByType = $this->makeReportTables(); - $this->archiveDayActions($archiveProcessor, $rankingQueryLimit, $tablesByType, - array_diff(array_keys($tablesByType), [Action::TYPE_SITE_SEARCH]), true); + $this->archiveDayActions( + $archiveProcessor, + $rankingQueryLimit, + $tablesByType, + array_diff(array_keys($tablesByType), [Action::TYPE_SITE_SEARCH]), + true + ); if ($archiveProcessor->getParams()->getSite()->isSiteSearchEnabled()) { $rankingQueryLimitSiteSearch = max($rankingQueryLimit, ArchivingHelper::$maximumRowsInDataTableSiteSearch); @@ -297,11 +302,29 @@ protected function archiveDayEntryActions(LogAggregator $logAggregator, array $a $groupBy = "log_visit.%s"; - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, $orderBy, - "visit_entry_idaction_url", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "visit_entry_idaction_url", + $rankingQuery + ); - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, $orderBy, - "visit_entry_idaction_name", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "visit_entry_idaction_name", + $rankingQuery + ); } /** @@ -341,11 +364,29 @@ protected function archiveDayExitActions(LogAggregator $logAggregator, array $ac $groupBy = "log_visit.%s"; - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, - $orderBy, "visit_exit_idaction_url", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "visit_exit_idaction_url", + $rankingQuery + ); - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, - $orderBy, "visit_exit_idaction_name", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "visit_exit_idaction_name", + $rankingQuery + ); return array($rankingQuery, $extraSelects, $from, $orderBy, $select, $where, $groupBy); } @@ -387,11 +428,29 @@ protected function archiveDayActionsTime(LogAggregator $logAggregator, array $ac $groupBy = "log_link_visit_action.%s"; - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, - $orderBy, "idaction_url_ref", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "idaction_url_ref", + $rankingQuery + ); - $this->archiveDayQueryProcess($logAggregator, $actionsTablesByType, $select, $from, $where, $groupBy, - $orderBy, "idaction_name_ref", $rankingQuery); + $this->archiveDayQueryProcess( + $logAggregator, + $actionsTablesByType, + $select, + $from, + $where, + $groupBy, + $orderBy, + "idaction_name_ref", + $rankingQuery + ); } protected function archiveDayQueryProcess( diff --git a/plugins/Actions/Tracker/ActionsRequestProcessor.php b/plugins/Actions/Tracker/ActionsRequestProcessor.php index 1c3c2804c7b..a001da2ec98 100644 --- a/plugins/Actions/Tracker/ActionsRequestProcessor.php +++ b/plugins/Actions/Tracker/ActionsRequestProcessor.php @@ -55,10 +55,16 @@ public function processRequestParams(VisitProperties $visitProperties, Request $ // save the exit actions of the last action in this visit as the referrer actions for the action being tracked. // when the visit is updated, these columns will be changed, so we have to do this before recordLogs - $request->setMetadata('Actions', 'idReferrerActionUrl', - $visitProperties->getProperty('visit_exit_idaction_url')); - $request->setMetadata('Actions', 'idReferrerActionName', - $visitProperties->getProperty('visit_exit_idaction_name')); + $request->setMetadata( + 'Actions', + 'idReferrerActionUrl', + $visitProperties->getProperty('visit_exit_idaction_url') + ); + $request->setMetadata( + 'Actions', + 'idReferrerActionName', + $visitProperties->getProperty('visit_exit_idaction_name') + ); } public function afterRequestProcessed(VisitProperties $visitProperties, Request $request) diff --git a/plugins/Actions/VisitorDetails.php b/plugins/Actions/VisitorDetails.php index 21195d35a34..dae2cfd0bdc 100644 --- a/plugins/Actions/VisitorDetails.php +++ b/plugins/Actions/VisitorDetails.php @@ -273,8 +273,10 @@ public function extendActionDetails(&$action, $nextAction, $visitorDetails) } // Convert datetimes to the site timezone - $dateTimeVisit = Date::factory($action['serverTimePretty'], - Site::getTimezoneFor($visitorDetails['idSite'])); + $dateTimeVisit = Date::factory( + $action['serverTimePretty'], + Site::getTimezoneFor($visitorDetails['idSite']) + ); $action['serverTimePretty'] = $dateTimeVisit->getLocalized(Date::DATETIME_FORMAT_SHORT); $action['timestamp'] = $dateTimeVisit->getTimestamp();