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