PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.4.0
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.4.0
9.5.11 9.5.10.1 9.5.10 trunk 9.4.0 9.4.1 9.4.2 9.4.3 9.5.0 9.5.0.1 9.5.0.2 9.5.1 9.5.2 9.5.2.2 9.5.2.3 9.5.3 9.5.3.1 9.5.3.2 9.5.4 9.5.5 9.5.6 9.5.7 9.5.8 9.5.9
really-simple-ssl / force-deactivate.txt
really-simple-ssl Last commit date
assets 11 months ago languages 11 months ago lets-encrypt 1 year ago lib 1 year ago mailer 1 year ago modal 11 months ago onboarding 1 year ago placeholders 1 year ago progress 1 year ago security 11 months ago settings 11 months ago testssl 5 years ago upgrade 1 year ago class-admin.php 1 year ago class-cache.php 2 years ago class-certificate.php 2 years ago class-front-end.php 1 year ago class-installer.php 1 year ago class-mixed-content-fixer.php 3 years ago class-multisite.php 1 year ago class-server.php 1 year ago class-site-health.php 1 year ago class-wp-cli.php 11 months ago compatibility.php 1 year ago force-deactivate.txt 1 year ago functions.php 1 year ago index.php 2 years ago readme.txt 11 months ago rector.php 1 year ago rlrsssl-really-simple-ssl.php 11 months ago rsssl-auto-loader.php 1 year ago security.md 2 years ago ssl-test-page.php 2 years ago system-status.php 1 year ago uninstall.php 1 year ago upgrade.php 11 months ago
force-deactivate.txt
137 lines
1 <?php
2 /*
3 * Deactivation page to simply deactivate the plugin when backend is not accessible anymore
4 * To deactivate:
5 * 1) rename this file to force-deactivate.php
6 * 2) Go in your browser to (note use of http, not https) http://yourdomain.com/wp-content/plugins/really-simple-ssl/force-deactivate.php.
7 * 3) IMPORTANT! On execution, this file will automatically get renamed to .txt. If you do not run it, don't forget to change it back.
8 */
9
10 ?>
11 <html>
12 <body>
13
14 <?php
15 # No need for the template engine
16 define( 'WP_USE_THEMES', false );
17
18 #find the base path
19 define( 'BASE_PATH', find_wordpress_base_path() . "/" );
20 # Load WordPress Core
21 if ( !file_exists(BASE_PATH . 'wp-load.php') ) {
22 die("WordPress not installed here");
23 }
24 //make sure the files are loaded
25 if (!defined('RSSSL_DOING_SYSTEM_STATUS')) define( 'RSSSL_DOING_SYSTEM_STATUS' , true);
26 define('RSSSL_LEARNING_MODE', true);
27 # Load WordPress Core
28 require_once( BASE_PATH . 'wp-load.php' );
29 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
30
31 rsssl_run_force_deactivate();
32 function rsssl_run_force_deactivate() {
33 $core_plugin = 'really-simple-ssl/rlrsssl-really-simple-ssl.php';
34 if ( ! is_plugin_active( $core_plugin ) ) {
35 echo "<h1>Really Simple Security is already deactivated!</h1>";
36 exit;
37 }
38
39 $step = 1;
40 echo "<h1>Force deactivation of Really Simple Security</h1>";
41 echo $step . ". Resetting options" . "<br>";
42 //ensure we can run the code
43 define( 'WP_CLI',true );
44 RSSSL()->admin->deactivate();
45 $step ++;
46
47 echo $step . ". Deactivating plugin" . "<br>";
48 rl_deactivate_plugin( RSSSL()->admin->plugin_dir . "/"
49 . RSSSL()->admin->plugin_filename );
50
51 $step ++;
52 echo $step . ". Completed<b>";
53 rename('force-deactivate.php' , 'force-deactivate.txt');
54 }
55
56 function rl_remove_plugin_from_array( $plugin, $current ) {
57 $key = array_search( $plugin, $current );
58 if ( false !== $key ) {
59 unset( $current[ $key ] );
60 }
61
62 return $current;
63 }
64
65 function rl_deactivate_plugin( $plugin ) {
66 $plugin = plugin_basename( trim( $plugin ) );
67
68 if ( is_multisite() ) {
69
70 $network_current = get_site_option( 'active_sitewide_plugins', array() );
71 if ( is_plugin_active_for_network( $plugin ) ) {
72 unset( $network_current[ $plugin ] );
73 }
74 update_site_option( 'active_sitewide_plugins', $network_current );
75
76 //remove plugin one by one on each site
77 $args = array(
78 'public' => 1,
79 );
80 $sites = get_sites($args);
81 foreach ( $sites as $site ) {
82 switch_to_blog($site->blog_id);
83 $current = get_option( 'active_plugins', array() );
84 $current = rl_remove_plugin_from_array( $plugin, $current );
85 update_option( 'active_plugins', $current );
86 restore_current_blog(); //switches back to previous blog, not current, so we have to do it each loop
87 }
88
89 } else {
90 $current = get_option( 'active_plugins', array() );
91 $current = rl_remove_plugin_from_array( $plugin, $current );
92 update_option( 'active_plugins', $current );
93 }
94 update_option( 'active_plugins', $current );
95 }
96
97 /**
98 * Helper function to find Wordpress base path.
99 */
100 function find_wordpress_base_path()
101 {
102 $path = __DIR__;
103
104 do {
105 if (file_exists($path . "/wp-config.php")) {
106 //check if the wp-load.php file exists here. If not, we assume it's in a subdir.
107 if ( file_exists( $path . '/wp-load.php') ) {
108 return $path;
109 } else {
110 //wp not in this directory. Look in each folder to see if it's there.
111 if ( file_exists( $path ) && $handle = opendir( $path ) ) {
112 while ( false !== ( $file = readdir( $handle ) ) ) {
113 if ( $file != "." && $file != ".." ) {
114 $file = $path .'/' . $file;
115 if ( is_dir( $file ) && file_exists( $file . '/wp-load.php') ) {
116 $path = $file;
117 break;
118 }
119 }
120 }
121 closedir( $handle );
122 }
123 }
124
125 return $path;
126 }
127 } while ($path = realpath("$path/.."));
128
129 return false;
130 }
131
132
133
134 ?>
135 </body>
136 </html>
137