| 1 |
<?php |
| 2 |
/** |
| 3 |
* FSI's contribution to the shared cleanup service. |
| 4 |
* |
| 5 |
* @package Templately |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Templately\Modules\FullSiteImport\Cleanup; |
| 9 |
|
| 10 |
use Templately\Modules\Utilities\Cleanup\TaskRegistry; |
| 11 |
|
| 12 |
/** |
| 13 |
* The one place this module names its cleanup tasks. |
| 14 |
* |
| 15 |
* Contribution is inverted: `modules/utilities/` never refers to full-site-import, |
| 16 |
* so removing or disabling this module removes its cleanups with it and the |
| 17 |
* engine needs no edit. This module declares `'utilities'` as a dependency; |
| 18 |
* the arrow points one way only. |
| 19 |
* |
| 20 |
* Four tasks, deliberately separate rather than one "clean up FSI" blob: each |
| 21 |
* reclaims a different kind of thing, each can fail independently without |
| 22 |
* costing the others their run, and the UI can estimate and offer them |
| 23 |
* individually. |
| 24 |
*/ |
| 25 |
final class CleanupTasks { |
| 26 |
|
| 27 |
public static function register(): void { |
| 28 |
add_action( |
| 29 |
TaskRegistry::COLLECT_ACTION, |
| 30 |
static function ( TaskRegistry $registry ) { |
| 31 |
$registry->register_classes( |
| 32 |
[ |
| 33 |
SessionsTask::class, |
| 34 |
TmpDirsTask::class, |
| 35 |
PreviewDirsTask::class, |
| 36 |
LogsTask::class, |
| 37 |
] |
| 38 |
); |
| 39 |
} |
| 40 |
); |
| 41 |
} |
| 42 |
} |
| 43 |
|