PluginProbe
AI / trunk
AI vtrunk
1.3.0 1.2.0 1.1.0 1.0.2 1.0.1 1.0.0 0.9.0 trunk 0.1.1 0.2.0 0.2.1 0.3.0 0.3.1 0.4.0 0.4.1 0.5.0 0.6.0 0.7.0 0.8.0
ai / includes / Admin / Deactivation.php

Deactivation.php in AI trunk, at includes/Admin/Deactivation.php

43 lines 781 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Runs on plugin deactivation.
4 *
5 * @package WordPress\AI\Admin
6 * @since 1.1.0
7 */
8
9 declare( strict_types=1 );
10
11 namespace WordPress\AI\Admin;
12
13 use WordPress\AI\Experiments\Key_Encryption\Key_Encryption;
14
15 // Exit if accessed directly.
16 defined( 'ABSPATH' ) || exit;
17
18 /**
19 * Deactivation routines.
20 *
21 * @internal
22 *
23 * @since 1.1.0
24 */
25 final class Deactivation {
26 /**
27 * Runs on plugin deactivation.
28 *
29 * Reverses the Key Encryption experiment when it is
30 * currently enabled so the user is never locked out of
31 * their API keys after deactivating the plugin.
32 *
33 * @since 1.1.0
34 */
35 public static function deactivation_callback(): void {
36 if ( ! Key_Encryption::is_effectively_enabled() ) {
37 return;
38 }
39
40 Key_Encryption::get_bridge()->decrypt_all();
41 }
42 }
43