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