PluginProbe ʕ •ᴥ•ʔ
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) / 9.5.10.1
Really Simple Security – Simple and Performant Security (formerly Really Simple SSL) v9.5.10.1
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 1 month ago core 1 month ago languages 1 month ago lets-encrypt 1 month ago lib 1 month ago mailer 1 month ago modal 1 month ago placeholders 1 month ago progress 1 month ago security 1 month ago settings 1 month ago testssl 1 month ago upgrade 1 month ago .wp-env.json 1 month ago SECURITY.md 1 month ago class-admin.php 1 month ago class-cache.php 1 month ago class-certificate.php 1 month ago class-front-end.php 1 month ago class-installer.php 1 month ago class-mixed-content-fixer.php 1 month ago class-multisite.php 1 month ago class-server.php 1 month ago class-site-health.php 1 month ago class-wp-cli.php 1 month ago compatibility.php 1 month ago force-deactivate.txt 1 month ago functions.php 1 month ago index.php 1 month ago readme.txt 1 month ago rector.php 1 month ago rlrsssl-really-simple-ssl.php 1 month ago rsssl-auto-loader.php 1 month ago sbom.json.gz 1 month ago ssl-test-page.php 1 month ago system-status.php 1 month ago uninstall.php 1 month ago upgrade.php 1 month 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