| Total Complexity | 5 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class DeleteFiles extends PruningTemplatesTemplate |
||
| 9 | { |
||
| 10 | public function getTitle(): string |
||
| 11 | { |
||
| 12 | return 'File specific pruning'; |
||
| 13 | } |
||
| 14 | |||
| 15 | public function getDescription(): string |
||
| 16 | { |
||
| 17 | return 'All versions are deleted for files that have been deleted.'; |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Prune versions of deleted files/folders. |
||
| 22 | */ |
||
| 23 | public function run(?bool $verbose = false) |
||
| 24 | { |
||
| 25 | if ($this->hasBeenDeleted()) { |
||
| 26 | $query = $this->getBaseQuery() |
||
| 27 | ->addWhere(['"RecordID" = ?' => $this->object->ID]) |
||
| 28 | ; |
||
| 29 | //starting from "keepVersions" - going backwards in time |
||
| 30 | $this->toDelete[$this->getUniqueKey()] += $this->addVersionNumberToArray( |
||
| 31 | $this->toDelete[$this->getUniqueKey()], |
||
| 32 | $query->execute() |
||
| 33 | ); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 37 | protected function hasBeenDeleted(): bool |
||
| 45 | } |
||
| 46 | } |
||
| 47 |