PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / myyoast-client / user-interface / myyoast-cleanup-integration.php

myyoast-cleanup-integration.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI trunk, at src/myyoast-client/user-interface/myyoast-cleanup-integration.php

69 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\MyYoast_Client\User_Interface;
4
5 use Yoast\WP\SEO\Conditionals\MyYoast_Connection_Conditional;
6 use Yoast\WP\SEO\Integrations\Integration_Interface;
7 use Yoast\WP\SEO\MyYoast_Client\Application\MyYoast_Client_Cleanup;
8
9 /**
10 * Handles cleanup of all MyYoast client data on plugin uninstall or through Yoast Test Helper.
11 */
12 class MyYoast_Cleanup_Integration implements Integration_Interface {
13
14 /**
15 * The cleanup service.
16 *
17 * @var MyYoast_Client_Cleanup
18 */
19 private $cleanup;
20
21 /**
22 * MyYoast_Cleanup_Integration constructor.
23 *
24 * @param MyYoast_Client_Cleanup $cleanup The cleanup service.
25 */
26 public function __construct( MyYoast_Client_Cleanup $cleanup ) {
27 $this->cleanup = $cleanup;
28 }
29
30 /**
31 * Returns the conditionals based on which this integration should be loaded.
32 *
33 * @return array<string> The array of conditionals.
34 */
35 public static function get_conditionals() {
36 return [ MyYoast_Connection_Conditional::class ];
37 }
38
39 /**
40 * Registers hooks.
41 *
42 * @return void
43 */
44 public function register_hooks(): void {
45 \add_action( 'uninstall_' . \WPSEO_BASENAME, [ $this, 'cleanup' ] );
46
47 /**
48 * Public action that wipes all local MyYoast OAuth client state
49 * (registered client, site/user tokens, key pairs, OIDC/JWKS/DPoP caches).
50 *
51 * Intended for development tooling that needs to reset state without
52 * uninstalling the plugin. The handler is the same one that runs on
53 * uninstall, so the effect is identical.
54 *
55 * @internal
56 */
57 \add_action( 'wpseo_myyoast_clear_client_state', [ $this, 'cleanup' ] );
58 }
59
60 /**
61 * Cleans up all MyYoast client data.
62 *
63 * @return void
64 */
65 public function cleanup(): void {
66 $this->cleanup->execute();
67 }
68 }
69