-
Notifications
You must be signed in to change notification settings - Fork 156
/
uninstall.php
48 lines (41 loc) · 1.6 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Uninstall AIOSEO
*
* @since 4.0.0
*/
// Exit if accessed directly.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
// Load plugin file.
require_once 'all_in_one_seo_pack.php';
// In case any of the versions - Lite or Pro - is still activated we bail.
// Meaning, if you delete Lite while the Pro is activated we bail, and vice-versa.
if (
defined( 'AIOSEO_FILE' ) &&
is_plugin_active( plugin_basename( AIOSEO_FILE ) )
) {
return;
}
// Disable Action Scheduler Queue Runner.
if ( class_exists( 'ActionScheduler_QueueRunner' ) ) {
ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request();
}
// Drop our custom tables.
aioseo()->core->uninstallDb();
// Remove translation files.
global $wp_filesystem; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
$languages_directory = defined( 'WP_LANG_DIR' ) ? trailingslashit( WP_LANG_DIR ) : trailingslashit( WP_CONTENT_DIR ) . 'languages/'; // phpcs:ignore Squiz.NamingConventions.ValidVariableName
$translations = glob( wp_normalize_path( $languages_directory . 'plugins/aioseo-*' ) ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
if ( ! empty( $translations ) ) {
foreach ( $translations as $file ) {
$wp_filesystem->delete( $file ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
}
}
$translations = glob( wp_normalize_path( $languages_directory . 'plugins/all-in-one-seo-*' ) ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
if ( ! empty( $translations ) ) {
foreach ( $translations as $file ) {
$wp_filesystem->delete( $file ); // phpcs:ignore Squiz.NamingConventions.ValidVariableName
}
}