| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\Integrations; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\Conditionals\No_Conditionals; |
| 6 |
|
| 7 |
/** |
| 8 |
* Class to manage the integration with the WP uninstall flow. |
| 9 |
*/ |
| 10 |
class Uninstall_Integration implements Integration_Interface { |
| 11 |
|
| 12 |
use No_Conditionals; |
| 13 |
|
| 14 |
/** |
| 15 |
* Initializes the integration. |
| 16 |
* |
| 17 |
* This is the place to register hooks and filters. |
| 18 |
* |
| 19 |
* @return void |
| 20 |
*/ |
| 21 |
public function register_hooks() { |
| 22 |
\add_action( 'uninstall_' . \WPSEO_BASENAME, [ $this, 'wpseo_uninstall' ] ); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Performs all necessary actions that should happen upon plugin uninstall. |
| 27 |
* |
| 28 |
* @return void |
| 29 |
*/ |
| 30 |
public function wpseo_uninstall() { |
| 31 |
$this->clear_import_statuses(); |
| 32 |
} |
| 33 |
|
| 34 |
/** |
| 35 |
* Clears the persistent import statuses. |
| 36 |
* |
| 37 |
* @return void |
| 38 |
*/ |
| 39 |
public function clear_import_statuses() { |
| 40 |
$yoast_options = \get_site_option( 'wpseo' ); |
| 41 |
|
| 42 |
if ( isset( $yoast_options['importing_completed'] ) ) { |
| 43 |
$yoast_options['importing_completed'] = []; |
| 44 |
|
| 45 |
\update_site_option( 'wpseo', $yoast_options ); |
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
|