PluginProbe
Patchstack – WordPress & Plugins Security / 2.1.16
Patchstack – WordPress & Plugins Security v2.1.16
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 +24 -15 2.1.22.1.16 View file →
@@ -29,8 +29,12 @@
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 +
33 37 if ( $plugin == $this->plugin->basename ) {
34 38
35 39 // In case of multisite, we want to redirect the user to a different page.
36 40 if ( $network_activation ) {
@@ -91,22 +95,8 @@
91 95 $this->activation_errors[] = 'Please upgrade your WordPress site to at least 4.3.0.';
92 96 return false;
93 97 }
94 98
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 -
109 99 return true;
110 100 }
111 101
112 102 /**
@@ -138,8 +128,27 @@
138 128 $this->requirements_not_met_notice();
139 129 exit;
140 130 }
141 131
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 +
142 151 // Make sure any rewrite functionality has been loaded.
143 152 $this->migrate();
144 153 add_option( 'patchstack_first_activated', '1' );
145 154
@@ -243,9 +252,9 @@
243 252 * @return void
244 253 */
245 254 public function migrate_check() {
246 255 // Only perform migrations if we have any to execute.
247 - $versions = array('3.0.0');
256 + $versions = array('3.0.0', '3.0.1');
248 257 if ( count( $versions ) == 0 ) {
249 258 return;
250 259 }
251 260