PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.2
Patchstack – WordPress & Plugins Security v2.1.2
2.3.7 trunk 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.17 2.1.18 2.1.19 2.1.2 2.1.20 2.1.21 2.1.22 2.1.23 2.1.24 2.1.25 2.1.3 2.1.4 2.1.5 2.1.6 All 49 releases
← All changes | includes/activation.php +15 -24 2.1.202.1.2 View file →
@@ -29,12 +29,8 @@
29 29 * @param boolean $network_activation If a network wide activation. (multisite)
30 30 * @return void
31 31 */
32 32 public function redirect_activation( $plugin, $network_activation ) {
33 - if ( defined( 'WP_CLI' ) && WP_CLI ) {
34 - return;
35 - }
36 -
37 33 if ( $plugin == $this->plugin->basename ) {
38 34
39 35 // In case of multisite, we want to redirect the user to a different page.
40 36 if ( $network_activation ) {
@@ -95,8 +91,22 @@
95 91 $this->activation_errors[] = 'Please upgrade your WordPress site to at least 4.3.0.';
96 92 return false;
97 93 }
98 94
95 + // Check if the webarx/webarx.php plugin is present, if so, remove it.
96 + if ( is_dir( WP_PLUGIN_DIR . '/webarx' ) ) {
97 +
98 + // Migrate all current options to the new prefix.
99 + global $wpdb;
100 + $wpdb->query( 'INSERT IGNORE INTO ' . $wpdb->prefix . "options (option_name, option_value, autoload) SELECT REPLACE(option_name, 'webarx_', 'patchstack_') as option_name, option_value, autoload FROM " . $wpdb->prefix . "options WHERE option_name like 'webarx_%'" );
101 + $wpdb->query( 'UPDATE ' . $wpdb->prefix . 'options AS a SET option_value = (SELECT option_value FROM ' . $wpdb->prefix . "options WHERE option_name = REPLACE(a.option_name, 'patchstack_', 'webarx_')) WHERE option_name LIKE 'patchstack_%'" );
102 +
103 + // Deactivate the plugin.
104 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
105 + deactivate_plugins( array( 'webarx/webarx.php' ) );
106 + update_option( 'patchstack_license_free', '0' );
107 + }
108 +
99 109 return true;
100 110 }
101 111
102 112 /**
@@ -128,27 +138,8 @@
128 138 $this->requirements_not_met_notice();
129 139 exit;
130 140 }
131 141
132 - // Check if the webarx/webarx.php plugin is present, if so, remove it.
133 - if ( is_dir( WP_PLUGIN_DIR . '/webarx' ) ) {
134 -
135 - // Migrate all current options to the new prefix.
136 - global $wpdb;
137 - $exists = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "options WHERE option_name = 'webarx_api_token'" );
138 -
139 - // Move over the options.
140 - if ( !is_null( $exists ) && $exists >= 1 ) {
141 - $wpdb->query( 'INSERT IGNORE INTO ' . $wpdb->prefix . "options (option_name, option_value, autoload) SELECT REPLACE(option_name, 'webarx_', 'patchstack_') as option_name, option_value, autoload FROM " . $wpdb->prefix . "options WHERE option_name like 'webarx_%'" );
142 - $wpdb->query( 'UPDATE ' . $wpdb->prefix . 'options AS a SET option_value = (SELECT option_value FROM ' . $wpdb->prefix . "options WHERE option_name = REPLACE(a.option_name, 'patchstack_', 'webarx_')) WHERE option_name LIKE 'patchstack_%'" );
143 - }
144 -
145 - // Deactivate the plugin.
146 - include_once ABSPATH . 'wp-admin/includes/plugin.php';
147 - deactivate_plugins( array( 'webarx/webarx.php' ) );
148 - update_option( 'patchstack_license_free', '0' );
149 - }
150 -
151 142 // Make sure any rewrite functionality has been loaded.
152 143 $this->migrate();
153 144 add_option( 'patchstack_first_activated', '1' );
154 145
@@ -252,9 +243,9 @@
252 243 * @return void
253 244 */
254 245 public function migrate_check() {
255 246 // Only perform migrations if we have any to execute.
256 - $versions = array('3.0.0', '3.0.1');
247 + $versions = array('3.0.0');
257 248 if ( count( $versions ) == 0 ) {
258 249 return;
259 250 }
260 251