InvalidationResult.php
56 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Matomo - free/libre analytics platform |
| 4 | * |
| 5 | * @link https://matomo.org |
| 6 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 7 | */ |
| 8 | |
| 9 | namespace Piwik\Archive\ArchiveInvalidator; |
| 10 | |
| 11 | use Piwik\Date; |
| 12 | |
| 13 | /** |
| 14 | * Information about the result of an archive invalidation operation. |
| 15 | */ |
| 16 | class InvalidationResult |
| 17 | { |
| 18 | /** |
| 19 | * Dates that couldn't be invalidated because they are earlier than the configured log |
| 20 | * deletion limit. |
| 21 | * |
| 22 | * @var array |
| 23 | */ |
| 24 | public $warningDates = array(); |
| 25 | |
| 26 | /** |
| 27 | * Dates that were successfully invalidated. |
| 28 | * |
| 29 | * @var array |
| 30 | */ |
| 31 | public $processedDates = array(); |
| 32 | |
| 33 | /** |
| 34 | * The day of the oldest log entry. |
| 35 | * |
| 36 | * @var Date|bool |
| 37 | */ |
| 38 | public $minimumDateWithLogs = false; |
| 39 | |
| 40 | /** |
| 41 | * @return string[] |
| 42 | */ |
| 43 | public function makeOutputLogs() |
| 44 | { |
| 45 | $output = array(); |
| 46 | if ($this->warningDates) { |
| 47 | $output[] = 'Warning: the following Dates have not been invalidated, because they are earlier than your Log Deletion limit: ' . |
| 48 | implode(", ", $this->warningDates) . |
| 49 | "\n The last day with logs is " . $this->minimumDateWithLogs . ". " . |
| 50 | "\n Please disable 'Delete old Logs' or set it to a higher deletion threshold (eg. 180 days or 365 years).'."; |
| 51 | } |
| 52 | |
| 53 | $output[] = "Success. The following dates were invalidated successfully: " . implode(", ", $this->processedDates); |
| 54 | return $output; |
| 55 | } |
| 56 | } |