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