all-in-one-seo-pack
Last commit date
app
1 month ago
dist
1 month ago
languages
1 month ago
vendor
1 month ago
all_in_one_seo_pack.php
1 month ago
readme.txt
1 month ago
uninstall.php
2 months ago
wpml-config.xml
5 years ago
uninstall.php
51 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Uninstall AIOSEO |
| 4 | * |
| 5 | * @since 4.0.0 |
| 6 | */ |
| 7 | |
| 8 | // phpcs:disable Squiz.NamingConventions.ValidVariableName |
| 9 | // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound |
| 10 | |
| 11 | // Exit if accessed directly. |
| 12 | if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | // Load plugin file. |
| 17 | require_once 'all_in_one_seo_pack.php'; |
| 18 | |
| 19 | // In case any of the versions - Lite or Pro - is still activated we bail. |
| 20 | // Meaning, if you delete Lite while the Pro is activated we bail, and vice-versa. |
| 21 | if ( |
| 22 | defined( 'AIOSEO_FILE' ) && |
| 23 | is_plugin_active( plugin_basename( AIOSEO_FILE ) ) |
| 24 | ) { |
| 25 | return; |
| 26 | } |
| 27 | |
| 28 | // Disable Action Scheduler Queue Runner. |
| 29 | if ( class_exists( 'ActionScheduler_QueueRunner' ) ) { |
| 30 | ActionScheduler_QueueRunner::instance()->unhook_dispatch_async_request(); |
| 31 | } |
| 32 | |
| 33 | // Drop our custom tables and data. |
| 34 | aioseo()->uninstall->dropData(); |
| 35 | |
| 36 | // Remove translation files. |
| 37 | global $wp_filesystem; |
| 38 | $languages_directory = defined( 'WP_LANG_DIR' ) ? trailingslashit( WP_LANG_DIR ) : trailingslashit( WP_CONTENT_DIR ) . 'languages/'; |
| 39 | $translations = glob( wp_normalize_path( $languages_directory . 'plugins/aioseo-*' ) ); |
| 40 | if ( ! empty( $translations ) ) { |
| 41 | foreach ( $translations as $file ) { |
| 42 | $wp_filesystem->delete( $file ); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | $translations = glob( wp_normalize_path( $languages_directory . 'plugins/all-in-one-seo-*' ) ); |
| 47 | if ( ! empty( $translations ) ) { |
| 48 | foreach ( $translations as $file ) { |
| 49 | $wp_filesystem->delete( $file ); |
| 50 | } |
| 51 | } |