PluginProbe
Plausible Analytics / trunk
Plausible Analytics vtrunk
2.6.1 2.6.0 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 All 52 releases
plausible-analytics / src / Uninstall.php

Uninstall.php in Plausible Analytics trunk, at src/Uninstall.php

69 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plausible Analytics | Uninstall script.
4 *
5 * @since 1.3.0
6 * @package WordPress
7 * @subpackage Plausible Analytics
8 */
9
10 namespace Plausible\Analytics\WP;
11
12 defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
13
14 /**
15 * This class is run upon uninstall and cleans up any data in the database and leftover files added by this plugin.
16 *
17 * @package Plausible\Analytics\WP
18 *
19 * @codeCoverageIgnore
20 */
21 class Uninstall {
22 /**
23 * Trigger logic.
24 *
25 * @return void
26 */
27 public function run() {
28 $this->delete_options();
29 $this->delete_transients();
30 $this->delete_proxy_speed_module();
31 }
32
33 /**
34 * Delete options.
35 *
36 * @return void
37 */
38 private function delete_options() {
39 delete_option( 'plausible_analytics_settings' );
40 delete_option( 'plausible_analytics_version' );
41 delete_option( 'plausible_analytics_proxy_resources' );
42 delete_option( 'plausible_analytics_created_mu_plugins_dir' );
43 delete_option( 'plausible_analytics_proxy_speed_module_installed' );
44 }
45
46 /**
47 * Delete transients.
48 *
49 * @return void
50 */
51 private function delete_transients() {
52 delete_transient( 'plausible_analytics_notice_dismissed' );
53 delete_transient( 'plausible_analytics_notice' );
54 }
55
56 /**
57 * Deletes the Proxy Speed Module from the mu-plugins directory.
58 *
59 * @return void
60 */
61 private function delete_proxy_speed_module() {
62 $file_path = WP_CONTENT_DIR . '/mu-plugins/plausible-proxy-speed-module.php';
63
64 if ( file_exists( $file_path ) ) {
65 wp_delete_file( $file_path );
66 }
67 }
68 }
69