diff options
Diffstat (limited to 'core/Archive/Single.php')
-rw-r--r-- | core/Archive/Single.php | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/core/Archive/Single.php b/core/Archive/Single.php index 991ecd7a67..464ecf7f31 100644 --- a/core/Archive/Single.php +++ b/core/Archive/Single.php @@ -134,12 +134,9 @@ class Piwik_Archive_Single extends Piwik_Archive { if(!is_null($this->archiveProcessing)) { - $timestamp = $this->archiveProcessing->getTimestampStartDate(); - if(!empty($timestamp)) - { - return $timestamp; - } + return $this->archiveProcessing->getTimestampStartDate(); } + return $this->period->getDateStart()->getTimestamp(); } @@ -155,20 +152,18 @@ class Piwik_Archive_Single extends Piwik_Archive { $this->isThereSomeVisits = false; $this->alreadyChecked = true; - $logMessage = "Preparing archive: "; + // if the END of the period is BEFORE the website creation date // we already know there are no stats for this period // we add one day to make sure we don't miss the day of the website creation if( $this->period->getDateEnd()->addDay(2)->isEarlier( $this->site->getCreationDate() ) ) { - Piwik::log("$logMessage skipped, archive is before the website was created."); - return; + return; } // if the starting date is in the future we know there is no visit - if( $this->period->getDateStart()->subDay(2)->isLater( Piwik_Date::today() ) ) + if( $this->period->getDateStart()->subDay(1)->isLater( Piwik_Date::today() ) ) { - Piwik::log("$logMessage skipped, archive is after today."); return; } @@ -178,17 +173,12 @@ class Piwik_Archive_Single extends Piwik_Archive $archiveProcessing->setSite($this->site); $archiveProcessing->setPeriod($this->period); $idArchive = $archiveProcessing->loadArchive(); - if(empty($idArchive)) + if($idArchive === null) { - Piwik::log("$logMessage not archived yet, starting processing..."); $archiveJustProcessed = true; $archiveProcessing->launchArchiving(); $idArchive = $archiveProcessing->getIdArchive(); } - else - { - Piwik::log("$logMessage archive already processed [id = $idArchive]..."); - } $this->isThereSomeVisits = $archiveProcessing->isThereSomeVisits; $this->idArchive = $idArchive; $this->archiveProcessing = $archiveProcessing; @@ -452,7 +442,7 @@ class Piwik_Archive_Single extends Piwik_Archive if($data === false && $idSubTable !== null) { - throw new Exception(Piwik_TranslateException('General_ExceptionSubtableNotFoundInArchive')); + throw new Exception("You are requesting a precise subTable but there is not such data in the Archive."); } return $table; |