PluginProbe
Search Atlas SEO – OTTO AI SEO Automation for WordPress / 2.7.1
Search Atlas SEO – OTTO AI SEO Automation for WordPress v2.7.1
2.7.1 2.7.2 2.7.0 2.6.26 2.6.25 2.6.24 2.6.23 2.6.22 2.6.21 2.6.20 2.6.19 2.6.18 2.6.17 2.6.16 2.6.15 2.6.14 2.6.13 2.6.12 2.6.11 2.6.10 2.6.9 2.6.8 2.6.7 2.6.6 2.6.5 All 141 releases
← All changes | includes/class-metasync-seo-restore.php +18 -23 2.7.0 → 2.7.1 View file →
@@ -478,9 +478,9 @@
478 478 }
479 479
480 480 $prefix_like = $wpdb->esc_like(Metasync_Seo_Backup::BACKUP_META_PREFIX) . '%';
481 481 if ($object_type === 'post') {
482 - return $wpdb->get_col($wpdb->prepare(
482 + return $wpdb->get_col($wpdb->prepare( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
483 483 "SELECT meta_key FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key LIKE %s",
484 484 $object_id,
485 485 $prefix_like
486 486 )) ?: [];
@@ -485,9 +485,9 @@
485 485 $prefix_like
486 486 )) ?: [];
487 487 }
488 488
489 - return $wpdb->get_col($wpdb->prepare(
489 + return $wpdb->get_col($wpdb->prepare( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
490 490 "SELECT meta_key FROM {$wpdb->termmeta} WHERE term_id = %d AND meta_key LIKE %s",
491 491 $object_id,
492 492 $prefix_like
493 493 )) ?: [];
@@ -568,17 +568,15 @@
568 568 if (!isset($wpdb)) {
569 569 return false;
570 570 }
571 571
572 - $table = ($object_type === 'post')
573 - ? $wpdb->prefix . 'aioseo_posts'
574 - : $wpdb->prefix . 'aioseo_terms';
572 + $is_post = ($object_type === 'post');
575 573
576 - $id_col = ($object_type === 'post') ? 'post_id' : 'term_id';
577 -
578 574 // If marker is '0', the row was created by MetaSync -> delete row.
579 575 if ($marker === '0') {
580 - $deleted = $wpdb->delete($table, [$id_col => $object_id]);
576 + $deleted = $is_post
577 + ? $wpdb->delete($wpdb->prefix . 'aioseo_posts', array('post_id' => $object_id)) // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
578 + : $wpdb->delete($wpdb->prefix . 'aioseo_terms', array('term_id' => $object_id));
581 579 return ($deleted !== false);
582 580 }
583 581
584 582 // Marker is '1' or absent (fail-closed to per-column update)
@@ -585,13 +583,11 @@
585 583 if (empty($columns)) {
586 584 return true;
587 585 }
588 586
589 - $updated = $wpdb->update(
590 - $table,
591 - $columns,
592 - [$id_col => $object_id]
593 - );
587 + $updated = $is_post
588 + ? $wpdb->update($wpdb->prefix . 'aioseo_posts', $columns, array('post_id' => $object_id)) // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
589 + : $wpdb->update($wpdb->prefix . 'aioseo_terms', $columns, array('term_id' => $object_id));
594 590
595 591 if ($updated === false) {
596 592 return false;
597 593 }
@@ -599,12 +595,11 @@
599 595 // 0 affected rows is ambiguous: identical values (fine) or the row is
600 596 // gone (the original values now have nowhere to live — fail so the
601 597 // backup keys survive). A row-existence probe settles it.
602 598 if ($updated === 0) {
603 - $exists = $wpdb->get_var($wpdb->prepare(
604 - "SELECT {$id_col} FROM {$table} WHERE {$id_col} = %d",
605 - $object_id
606 - ));
599 + $exists = $is_post
600 + ? $wpdb->get_var($wpdb->prepare("SELECT post_id FROM {$wpdb->prefix}aioseo_posts WHERE post_id = %d", $object_id)) // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
601 + : $wpdb->get_var($wpdb->prepare("SELECT term_id FROM {$wpdb->prefix}aioseo_terms WHERE term_id = %d", $object_id));
607 602 return ($exists !== null);
608 603 }
609 604
610 605 return true;
@@ -627,9 +622,9 @@
627 622 $table = $wpdb->prefix . 'yoast_indexable';
628 623
629 624 // If marker is '0', the row was created by MetaSync -> delete row.
630 625 if ($marker === '0') {
631 - $deleted = $wpdb->delete($table, [
626 + $deleted = $wpdb->delete($table, [ // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
632 627 'object_id' => $post_id,
633 628 'object_type' => 'post',
634 629 ]);
635 630 return ($deleted !== false);
@@ -639,9 +634,9 @@
639 634 if (empty($columns)) {
640 635 return true;
641 636 }
642 637
643 - $updated = $wpdb->update(
638 + $updated = $wpdb->update( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
644 639 $table,
645 640 $columns,
646 641 [
647 642 'object_id' => $post_id,
@@ -656,10 +651,10 @@
656 651 // 0 affected rows: identical values (fine) or the row is gone (the
657 652 // original values now have nowhere to live — fail so the backups
658 653 // survive). Probe for the row to tell the two apart.
659 654 if ($updated === 0) {
660 - $exists = $wpdb->get_var($wpdb->prepare(
661 - "SELECT object_id FROM {$table} WHERE object_id = %d AND object_type = 'post'",
655 + $exists = $wpdb->get_var($wpdb->prepare( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
656 + "SELECT object_id FROM {$wpdb->prefix}yoast_indexable WHERE object_id = %d AND object_type = 'post'",
662 657 $post_id
663 658 ));
664 659 return ($exists !== null);
665 660 }
@@ -1168,9 +1163,9 @@
1168 1163
1169 1164 // 1. Posts with backup meta (keyset paginated by post_id)
1170 1165 $last_id = 0;
1171 1166 do {
1172 - $posts = $wpdb->get_col($wpdb->prepare(
1167 + $posts = $wpdb->get_col($wpdb->prepare( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
1173 1168 "SELECT DISTINCT post_id
1174 1169 FROM {$wpdb->postmeta}
1175 1170 WHERE meta_key LIKE %s AND post_id > %d
1176 1171 ORDER BY post_id ASC
@@ -1191,9 +1186,9 @@
1191 1186
1192 1187 // 2. Terms with backup meta (keyset paginated by term_id)
1193 1188 $last_id = 0;
1194 1189 do {
1195 - $terms = $wpdb->get_col($wpdb->prepare(
1190 + $terms = $wpdb->get_col($wpdb->prepare( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- restore tool — exact-row bulk migration including third-party tables; no bulk WordPress API
1196 1191 "SELECT DISTINCT term_id
1197 1192 FROM {$wpdb->termmeta}
1198 1193 WHERE meta_key LIKE %s AND term_id > %d
1199 1194 ORDER BY term_id ASC