Нет описания

uninstall.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Functionality that is executed when Jetpack is uninstalled via built-in WordPress commands.
  4. *
  5. * @package automattic/jetpack
  6. */
  7. use Automattic\Jetpack\Backup\Helper_Script_Manager;
  8. use Automattic\Jetpack\Sync\Sender;
  9. /**
  10. * Uninstall script for Jetpack.
  11. */
  12. function jetpack_uninstall() {
  13. if (
  14. ! defined( 'WP_UNINSTALL_PLUGIN' ) ||
  15. ! WP_UNINSTALL_PLUGIN ||
  16. dirname( WP_UNINSTALL_PLUGIN ) !== dirname( plugin_basename( __FILE__ ) )
  17. ) {
  18. status_header( 404 );
  19. exit;
  20. }
  21. if ( ! defined( 'JETPACK__PLUGIN_DIR' ) ) {
  22. define( 'JETPACK__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  23. }
  24. require JETPACK__PLUGIN_DIR . 'vendor/autoload_packages.php';
  25. Jetpack_Options::delete_all_known_options();
  26. // Delete all legacy options.
  27. delete_option( 'jetpack_was_activated' );
  28. delete_option( 'jetpack_auto_installed' );
  29. delete_option( 'jetpack_register' );
  30. delete_transient( 'jetpack_register' );
  31. // Delete sync options
  32. //
  33. // Do not initialize any listeners.
  34. // Since all the files will be deleted.
  35. // No need to try to sync anything.
  36. add_filter( 'jetpack_sync_modules', '__return_empty_array', 100 );
  37. // Jetpack Sync.
  38. Sender::get_instance()->uninstall();
  39. // Jetpack Backup: Cleanup any leftover Helper Scripts.
  40. Helper_Script_Manager::delete_all_helper_scripts();
  41. }
  42. jetpack_uninstall();