| 1 |
<?php |
| 2 |
|
| 3 |
if (!defined('ABSPATH')) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
/** |
| 8 |
* Handles action 'runMaintenance': triggers the redirects retention cron |
| 9 |
* (delete redirects older than the configured age) on demand from the admin UI. |
| 10 |
*/ |
| 11 |
class ABJ_404_Solution_RunMaintenanceHandler implements ABJ_404_Solution_AdminActionHandlerInterface { |
| 12 |
|
| 13 |
public function nonceAction(): string { |
| 14 |
return 'abj404_runMaintenance'; |
| 15 |
} |
| 16 |
|
| 17 |
public function nonceArg(): string { |
| 18 |
return '_wpnonce'; |
| 19 |
} |
| 20 |
|
| 21 |
public function useCheckAdminReferer(): bool { |
| 22 |
return true; |
| 23 |
} |
| 24 |
|
| 25 |
public function handle(string $action, string &$sub): string { |
| 26 |
$message = abj_service('redirects_retention_service')->deleteOldRedirectsCron(); |
| 27 |
return is_string($message) ? $message : ''; |
| 28 |
} |
| 29 |
} |
| 30 |
|