PluginProbe
Import WP – CSV & XML Import Export for WordPress / 2.15.0
Import WP – CSV & XML Import Export for WordPress v2.15.0
2.15.1 2.15.0 2.14.24 2.14.23 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 2.9.1 All 144 releases
← All changes | class/Common/Runner/RunnerState.php +13 -40 2.8.0 → 2.15.0 View file →
@@ -43,15 +43,15 @@
43 43 {
44 44 $state = self::wait_for_lock_and_get_state($this->id, $this->user, $this->default($session));
45 45
46 46 if (!$state || !isset($state['status'])) {
47 - throw new \Exception("Invalid state");
47 + throw new \Exception(__("Invalid state", 'jc-importer'));
48 48 }
49 49
50 50 $this->populate($state);
51 51
52 52 if (!$this->validate($session)) {
53 - throw new \Exception("Session has changed");
53 + throw new \Exception(__("Session has changed", 'jc-importer'));
54 54 }
55 55 }
56 56
57 57
@@ -178,9 +178,9 @@
178 178 list($has_lock, $result) = self::try_get_lock($id, $user, $callback);
179 179 } while (!$has_lock && (microtime(true) - $start < 30));
180 180
181 181 if (!$has_lock) {
182 - throw new \Exception("Unable to get lock");
182 + throw new \Exception(__("Unable to get lock", 'jc-importer'));
183 183 }
184 184
185 185 return $result;
186 186 }
@@ -262,22 +262,13 @@
262 262 $lock_option_id = sprintf('iwp_' . static::$object_type . '_lock_%d', $id);
263 263 $existing = self::get_option($lock_option_id, false);
264 264
265 265 if ($existing !== false) {
266 - if (is_multisite()) {
267 - $query = $wpdb->prepare(
268 - "UPDATE {$wpdb->sitemeta} SET meta_value=%s WHERE site_id=%d AND meta_key=%s AND meta_value=''",
269 - $user,
270 - $wpdb->siteid,
271 - $lock_option_id
272 - );
273 - } else {
274 - $query = $wpdb->prepare(
275 - "UPDATE {$wpdb->options} SET option_value=%s WHERE option_name=%s AND option_value=''",
276 - $user,
277 - $lock_option_id
278 - );
279 - }
266 + $query = $wpdb->prepare(
267 + "UPDATE {$wpdb->options} SET option_value=%s WHERE option_name=%s AND option_value=''",
268 + $user,
269 + $lock_option_id
270 + );
280 271 } else {
281 272 return self::update_option($lock_option_id, '');
282 273 }
283 274
@@ -315,13 +306,9 @@
315 306 * @var \WPDB $wpdb
316 307 */
317 308 global $wpdb;
318 309
319 - if (is_multisite()) {
320 - $query = $wpdb->prepare("SELECT meta_id as id, meta_value as data FROM {$wpdb->sitemeta} WHERE site_id=%s AND meta_key=%s LIMIT 1", [$wpdb->siteid, $key]);
321 - } else {
322 - $query = $wpdb->prepare("SELECT option_id as id, option_value as data FROM {$wpdb->options} WHERE option_name=%s LIMIT 1", [$key]);
323 - }
310 + $query = $wpdb->prepare("SELECT option_id as id, option_value as data FROM {$wpdb->options} WHERE option_name=%s LIMIT 1", [$key]);
324 311
325 312 $result = $wpdb->get_row($query, ARRAY_A);
326 313 if (!$result) {
327 314 return $default;
@@ -342,21 +329,12 @@
342 329 global $wpdb;
343 330
344 331 $result = self::get_option($key);
345 332
346 - if (is_multisite()) {
347 -
348 - if ($result !== false) {
349 - $result = $wpdb->update($wpdb->sitemeta, ['meta_value' => $value], ['meta_key' => $key, 'site_id' => $wpdb->siteid], ['%s'], ['%s', '%s']);
350 - } else {
351 - $result = $wpdb->insert($wpdb->sitemeta, ['meta_value' => $value, 'meta_key' => $key, 'site_id' => $wpdb->siteid], ['%s', '%s', '%s']);
352 - }
333 + if ($result !== false) {
334 + $result = $wpdb->update($wpdb->options, ['option_value' => $value], ['option_name' => $key], ['%s'], ['%s']);
353 335 } else {
354 - if ($result !== false) {
355 - $result = $wpdb->update($wpdb->options, ['option_value' => $value], ['option_name' => $key], ['%s'], ['%s']);
356 - } else {
357 - $result = $wpdb->insert($wpdb->options, ['option_value' => $value, 'option_name' => $key], ['%s', '%s']);
358 - }
336 + $result = $wpdb->insert($wpdb->options, ['option_value' => $value, 'option_name' => $key], ['%s', '%s']);
359 337 }
360 338
361 339 return $result;
362 340 }
@@ -373,12 +351,7 @@
373 351 /**
374 352 * @var \WPDB $wpdb
375 353 */
376 354 global $wpdb;
377 -
378 - if (is_multisite()) {
379 - $wpdb->query("DELETE FROM {$wpdb->sitemeta} WHERE meta_key LIKE 'iwp\_" . static::$object_type . "\_state\_" . $id . "\_%'");
380 - } else {
381 - $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'iwp\_" . static::$object_type . "\_state\_" . $id . "\_%'");
382 - }
355 + $wpdb->query("DELETE FROM {$wpdb->options} WHERE option_name LIKE 'iwp\_" . static::$object_type . "\_state\_" . $id . "\_%'");
383 356 }
384 357 }