Skip to content

Commit

Permalink
Merge branch '5.0.x-dev' into 5.x-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Jan 24, 2024
2 parents 6b5cef0 + 6199cd6 commit d6d5516
Show file tree
Hide file tree
Showing 148 changed files with 1,137 additions and 520 deletions.
12 changes: 9 additions & 3 deletions core/API/DataTableManipulator/Flattener.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,15 @@ protected function flattenDataTableInto($dataTable, $newDataTable, $level, $dime
* @param string $dimensionName
* @param bool $parentLogo
*/
private function flattenRow(Row $row, $rowId, DataTable $dataTable, $level, $dimensionName,
$labelPrefix = '', $parentLogo = false)
{
private function flattenRow(
Row $row,
$rowId,
DataTable $dataTable,
$level,
$dimensionName,
$labelPrefix = '',
$parentLogo = false
) {
$dimensions = $dataTable->getMetadata('dimensions');

if (empty($dimensions)) {
Expand Down
34 changes: 25 additions & 9 deletions core/Archive/ArchiveInvalidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,16 @@ private function deleteOptionLike($id)
* @return InvalidationResult
* @throws \Exception
*/
public function markArchivesAsInvalidated(array $idSites, array $dates, $period, Segment $segment = null, $cascadeDown = false,
$forceInvalidateNonexistentRanges = false, $name = null, $ignorePurgeLogDataDate = false)
{
public function markArchivesAsInvalidated(
array $idSites,
array $dates,
$period,
Segment $segment = null,
$cascadeDown = false,
$forceInvalidateNonexistentRanges = false,
$name = null,
$ignorePurgeLogDataDate = false
) {
$plugin = null;
if ($name && strpos($name, '.') !== false) {
list($plugin) = explode('.', $name);
Expand Down Expand Up @@ -551,9 +558,13 @@ public function removeInvalidations($idSite, $plugin, $report = null)
* @param string|null $report
* @param Date|null $startDate
*/
public function scheduleReArchiving($idSites, string $pluginName = null, $report = null, Date $startDate = null,
Segment $segment = null)
{
public function scheduleReArchiving(
$idSites,
string $pluginName = null,
$report = null,
Date $startDate = null,
Segment $segment = null
) {
if (!empty($report)) {
$this->removeInvalidationsSafely($idSites, $pluginName, $report);
}
Expand Down Expand Up @@ -682,9 +693,14 @@ public function removeInvalidationsFromDistributedList($idSites, $pluginName = n
* @param string[][][] $dates
* @throws \Exception
*/
private function markArchivesInvalidated($idSites, $dates, Segment $segment = null, $removeRanges = false,
$forceInvalidateNonexistentRanges = false, $name = null)
{
private function markArchivesInvalidated(
$idSites,
$dates,
Segment $segment = null,
$removeRanges = false,
$forceInvalidateNonexistentRanges = false,
$name = null
) {
$idSites = array_map('intval', $idSites);

$yearMonths = [];
Expand Down
17 changes: 9 additions & 8 deletions core/ArchiveProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,15 @@ public function getLogAggregator()
* )
* @api
*/
public function aggregateDataTableRecords($recordNames,
$maximumRowsInDataTableLevelZero = null,
$maximumRowsInSubDataTable = null,
$defaultColumnToSortByBeforeTruncation = null,
&$columnsAggregationOperation = null,
$columnsToRenameAfterAggregation = null,
$countRowsRecursive = true)
{
public function aggregateDataTableRecords(
$recordNames,
$maximumRowsInDataTableLevelZero = null,
$maximumRowsInSubDataTable = null,
$defaultColumnToSortByBeforeTruncation = null,
&$columnsAggregationOperation = null,
$columnsToRenameAfterAggregation = null,
$countRowsRecursive = true
) {
/** @var LoggerInterface $logger */
$logger = StaticContainer::get(LoggerInterface::class);

Expand Down
22 changes: 15 additions & 7 deletions core/ArchiveProcessor/RecordBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,13 @@ abstract class RecordBuilder
* @param string|null $columnToSortByBeforeTruncation
* @param array|null $columnAggregationOps
*/
public function __construct(?int $maxRowsInTable = null, ?int $maxRowsInSubtable = null,
?string $columnToSortByBeforeTruncation = null, ?array $columnAggregationOps = null,
?array $columnToRenameAfterAggregation = null)
{
public function __construct(
?int $maxRowsInTable = null,
?int $maxRowsInSubtable = null,
?string $columnToSortByBeforeTruncation = null,
?array $columnAggregationOps = null,
?array $columnToRenameAfterAggregation = null
) {
$this->maxRowsInTable = $maxRowsInTable;
$this->maxRowsInSubtable = $maxRowsInSubtable;
$this->columnToSortByBeforeTruncation = $columnToSortByBeforeTruncation;
Expand Down Expand Up @@ -277,9 +280,14 @@ abstract public function getRecordMetadata(ArchiveProcessor $archiveProcessor):
*/
abstract protected function aggregate(ArchiveProcessor $archiveProcessor): array;

protected function insertBlobRecord(ArchiveProcessor $archiveProcessor, string $recordName, DataTable $record,
?int $maxRowsInTable, ?int $maxRowsInSubtable, ?string $columnToSortByBeforeTruncation): void
{
protected function insertBlobRecord(
ArchiveProcessor $archiveProcessor,
string $recordName,
DataTable $record,
?int $maxRowsInTable,
?int $maxRowsInSubtable,
?string $columnToSortByBeforeTruncation
): void {
$serialized = $record->getSerialized(
$maxRowsInTable ?: $this->maxRowsInTable,
$maxRowsInSubtable ?: $this->maxRowsInSubtable,
Expand Down
16 changes: 8 additions & 8 deletions core/ArchiveProcessor/Rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ public static function getDoneFlags(array $plugins, Segment $segment)
}

public static function getMinTimeProcessedForInProgressArchive(
Date $dateStart,
\Piwik\Period $period,
Segment $segment,
Site $site
Date $dateStart,
\Piwik\Period $period,
Segment $segment,
Site $site
) {
$todayArchiveTimeToLive = self::getPeriodArchiveTimeToLiveDefault($period->getLabel());

Expand Down Expand Up @@ -326,9 +326,9 @@ public static function isSegmentPreProcessed(array $idSites, Segment $segment)
* @return string[]
*/
public static function getSelectableDoneFlagValues(
$includeInvalidated = true,
Parameters $params = null,
$checkAuthorizedToArchive = true
$includeInvalidated = true,
Parameters $params = null,
$checkAuthorizedToArchive = true
) {
$possibleValues = array(ArchiveWriter::DONE_OK, ArchiveWriter::DONE_OK_TEMPORARY);

Expand Down Expand Up @@ -372,7 +372,7 @@ public static function isSegmentPluginArchivingDisabled($pluginName, $siteId = n

if (is_string($pluginArchivingSetting)) {
$pluginArchivingSetting = explode(",", $pluginArchivingSetting);
$pluginArchivingSetting = array_filter($pluginArchivingSetting, function($plugin) {
$pluginArchivingSetting = array_filter($pluginArchivingSetting, function ($plugin) {
return Manager::getInstance()->isValidPluginName($plugin);
});
}
Expand Down
15 changes: 11 additions & 4 deletions core/CronArchive/QueueConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,17 @@ class QueueConsumer

private $processedSiteCount = 0;

public function __construct(LoggerInterface $logger, $websiteIdArchiveList, $countOfProcesses, $pid, Model $model,
SegmentArchiving $segmentArchiving, CronArchive $cronArchive, RequestParser $cliMultiRequestParser,
ArchiveFilter $archiveFilter = null)
{
public function __construct(
LoggerInterface $logger,
$websiteIdArchiveList,
$countOfProcesses,
$pid,
Model $model,
SegmentArchiving $segmentArchiving,
CronArchive $cronArchive,
RequestParser $cliMultiRequestParser,
ArchiveFilter $archiveFilter = null
) {
$this->logger = $logger;
$this->websiteIdArchiveList = $websiteIdArchiveList;
$this->countOfProcesses = $countOfProcesses;
Expand Down
11 changes: 7 additions & 4 deletions core/CronArchive/SegmentArchiving.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,13 @@ class SegmentArchiving
*/
private $forceArchiveAllSegments;

public function __construct($beginningOfTimeLastNInYears = self::DEFAULT_BEGINNING_OF_TIME_LAST_N_YEARS,
Model $segmentEditorModel = null, Cache $segmentListCache = null, Date $now = null,
LoggerInterface $logger = null)
{
public function __construct(
$beginningOfTimeLastNInYears = self::DEFAULT_BEGINNING_OF_TIME_LAST_N_YEARS,
Model $segmentEditorModel = null,
Cache $segmentListCache = null,
Date $now = null,
LoggerInterface $logger = null
) {
$this->processNewSegmentsFrom = StaticContainer::get('ini.General.process_new_segments_from');
$this->beginningOfTimeLastNInYears = $beginningOfTimeLastNInYears;
$this->segmentEditorModel = $segmentEditorModel ?: new Model();
Expand Down
3 changes: 2 additions & 1 deletion core/DataAccess/ArchivingDbAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ private function logSql($sql)
}
}

private function callFunction($function, ...$args) {
private function callFunction($function, ...$args)
{

try {
return call_user_func_array([$this->wrapped, $function], $args);
Expand Down
38 changes: 28 additions & 10 deletions core/DataAccess/LogAggregator.php
Original file line number Diff line number Diff line change
Expand Up @@ -589,10 +589,16 @@ public function getMetricsFromVisitByDimension($dimension)
* ranking query SQL will be immediately executed and the results returned.
* @api
*/
public function queryVisitsByDimension(array $dimensions = [], $where = false, array $additionalSelects = [],
$metrics = false, $rankingQuery = false, $orderBy = false, $timeLimit = -1,
$rankingQueryGenerate = false)
{
public function queryVisitsByDimension(
array $dimensions = [],
$where = false,
array $additionalSelects = [],
$metrics = false,
$rankingQuery = false,
$orderBy = false,
$timeLimit = -1,
$rankingQueryGenerate = false
) {
$query = $this->getQueryByDimensionSql($dimensions, $where, $additionalSelects, $metrics, $rankingQuery, $orderBy,
$timeLimit, $rankingQueryGenerate);

Expand Down Expand Up @@ -620,9 +626,16 @@ public function queryVisitsByDimension(array $dimensions = [], $where = false, a
* @throws \Piwik\Exception\DI\DependencyException
* @throws \Piwik\Exception\DI\NotFoundException
*/
public function getQueryByDimensionSql(array $dimensions, $where, array $additionalSelects, $metrics, $rankingQuery,
$orderBy, $timeLimit, $rankingQueryGenerate): array
{
public function getQueryByDimensionSql(
array $dimensions,
$where,
array $additionalSelects,
$metrics,
$rankingQuery,
$orderBy,
$timeLimit,
$rankingQueryGenerate
): array {
$tableName = self::LOG_VISIT_TABLE;
$availableMetrics = $this->getVisitsMetricFields();

Expand Down Expand Up @@ -1158,9 +1171,14 @@ protected function getActionsMetricFields()
* ranking query SQL will be immediately executed and the results returned.
* @return \Zend_Db_Statement|array
*/
public function queryConversionsByDimension($dimensions = array(), $where = false, $additionalSelects = array(), $extraFrom = [],
$rankingQuery = false, $rankingQueryGenerate = false)
{
public function queryConversionsByDimension(
$dimensions = array(),
$where = false,
$additionalSelects = array(),
$extraFrom = [],
$rankingQuery = false,
$rankingQueryGenerate = false
) {
$dimensions = array_merge(array(self::IDGOAL_FIELD), $dimensions);
$tableName = self::LOG_CONVERSION_TABLE;
$availableMetrics = $this->getConversionsMetricFields();
Expand Down
13 changes: 10 additions & 3 deletions core/DataAccess/LogQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ public function getForcedInnerGroupBySubselect()
return $this->forcedInnerGroupBy;
}

public function getSelectQueryString(SegmentExpression $segmentExpression, $select, $from, $where, $bind, $groupBy,
$orderBy, $limitAndOffset)
{
public function getSelectQueryString(
SegmentExpression $segmentExpression,
$select,
$from,
$where,
$bind,
$groupBy,
$orderBy,
$limitAndOffset
) {
if (!is_array($from)) {
$from = array($from);
}
Expand Down
24 changes: 18 additions & 6 deletions core/DataAccess/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ public function getInvalidatedArchiveIdsSafeToDelete($archiveTable, $setGroupCon
return $archiveIds;
}

public function updateArchiveAsInvalidated($archiveTable, $idSites, $allPeriodsToInvalidate, Segment $segment = null,
$forceInvalidateNonexistentRanges = false, $name = null)
{
public function updateArchiveAsInvalidated(
$archiveTable,
$idSites,
$allPeriodsToInvalidate,
Segment $segment = null,
$forceInvalidateNonexistentRanges = false,
$name = null
) {
if (empty($idSites)) {
return 0;
}
Expand Down Expand Up @@ -424,9 +429,16 @@ public function deleteOlderArchives(Parameters $params, $name, $tsArchived, $idA
$this->deleteArchiveIds($numericTable, $blobTable, $idArchives);
}

public function getArchiveIdAndVisits($numericTable, $idSite, $period, $dateStartIso, $dateEndIso, $minDatetimeIsoArchiveProcessedUTC,
$doneFlags, $doneFlagValues = null)
{
public function getArchiveIdAndVisits(
$numericTable,
$idSite,
$period,
$dateStartIso,
$dateEndIso,
$minDatetimeIsoArchiveProcessedUTC,
$doneFlags,
$doneFlagValues = null
) {
$bindSQL = array($idSite,
$dateStartIso,
$dateEndIso,
Expand Down
11 changes: 6 additions & 5 deletions core/DataTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -1335,11 +1335,12 @@ public static function isEqual(DataTable $table1, DataTable $table2)
* // etc.
* );
*/
public function getSerialized($maximumRowsInDataTable = null,
$maximumRowsInSubDataTable = null,
$columnToSortByBeforeTruncation = null,
&$aSerializedDataTable = array())
{
public function getSerialized(
$maximumRowsInDataTable = null,
$maximumRowsInSubDataTable = null,
$columnToSortByBeforeTruncation = null,
&$aSerializedDataTable = array()
) {
static $depth = 0;
// make sure subtableIds are consecutive from 1 to N
static $subtableId = 0;
Expand Down
12 changes: 9 additions & 3 deletions core/DataTable/Filter/ColumnCallbackAddColumnQuotient.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,15 @@ class ColumnCallbackAddColumnQuotient extends BaseFilter
* @param bool $getDivisorFromSummaryRow Whether to get the divisor from the summary row or the current
* row iteration.
*/
public function __construct($table, $columnNameToAdd, $columnValueToRead, $divisorValueOrDivisorColumnName,
$quotientPrecision = 0, $shouldSkipRows = false, $getDivisorFromSummaryRow = false)
{
public function __construct(
$table,
$columnNameToAdd,
$columnValueToRead,
$divisorValueOrDivisorColumnName,
$quotientPrecision = 0,
$shouldSkipRows = false,
$getDivisorFromSummaryRow = false
) {
parent::__construct($table);
$this->table = $table;
$this->columnValueToRead = $columnValueToRead;
Expand Down
11 changes: 8 additions & 3 deletions core/DataTable/Filter/ColumnCallbackAddMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,14 @@ class ColumnCallbackAddMetadata extends BaseFilter
* instead.
* @param bool $applyToSummaryRow Whether the callback should be applied to the summary row or not.
*/
public function __construct($table, $columnsToRead, $metadataToAdd, $functionToApply = null,
$functionParameters = null, $applyToSummaryRow = true)
{
public function __construct(
$table,
$columnsToRead,
$metadataToAdd,
$functionToApply = null,
$functionParameters = null,
$applyToSummaryRow = true
) {
parent::__construct($table);

if (!is_array($columnsToRead)) {
Expand Down
Loading

0 comments on commit d6d5516

Please sign in to comment.