| 1 |
<?php |
| 2 |
/** |
| 3 |
* All functionality related to deactivating the plugin. |
| 4 |
* |
| 5 |
* @since 0.1.0 |
| 6 |
* |
| 7 |
* @package SolidWP\Performance |
| 8 |
*/ |
| 9 |
|
| 10 |
declare( strict_types=1 ); |
| 11 |
|
| 12 |
namespace SolidWP\Performance\Plugin; |
| 13 |
|
| 14 |
use SolidWP\Performance\Config\Advanced_Cache; |
| 15 |
use SolidWP\Performance\Container; |
| 16 |
|
| 17 |
if ( ! defined( 'ABSPATH' ) ) { |
| 18 |
exit; |
| 19 |
} |
| 20 |
|
| 21 |
/** |
| 22 |
* Handles actions that should run when the plugin is deactivated. |
| 23 |
* |
| 24 |
* @since 0.1.0 |
| 25 |
* |
| 26 |
* @package SolidWP\Performance |
| 27 |
*/ |
| 28 |
final class Deactivator { |
| 29 |
|
| 30 |
/** |
| 31 |
* @var Container |
| 32 |
*/ |
| 33 |
private Container $container; |
| 34 |
|
| 35 |
/** |
| 36 |
* @param Container $container The container. |
| 37 |
*/ |
| 38 |
public function __construct( Container $container ) { |
| 39 |
$this->container = $container; |
| 40 |
} |
| 41 |
|
| 42 |
/** |
| 43 |
* Deactivation hook. |
| 44 |
* |
| 45 |
* @since 0.1.0 |
| 46 |
* |
| 47 |
* @return void |
| 48 |
*/ |
| 49 |
public function __invoke(): void { |
| 50 |
$this->remove_advanced_cache(); |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* Remove the generated advanced-cache.php drop-in. |
| 55 |
* |
| 56 |
* @since 0.1.0 |
| 57 |
* |
| 58 |
* @return void |
| 59 |
*/ |
| 60 |
private function remove_advanced_cache(): void { |
| 61 |
$this->container->get( Advanced_Cache::class )->remove(); |
| 62 |
} |
| 63 |
} |
| 64 |
|