PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
← All changes | jetpack_vendor/automattic/jetpack-sync/src/modules/class-term-relationships.php +27 -6 13.5.2 → 16.3-beta View file →
@@ -9,8 +9,12 @@
9 9
10 10 use Automattic\Jetpack\Sync\Listener;
11 11 use Automattic\Jetpack\Sync\Settings;
12 12
13 +if ( ! defined( 'ABSPATH' ) ) {
14 + exit( 0 );
15 +}
16 +
13 17 /**
14 18 * Class to handle sync for term relationships.
15 19 */
16 20 class Term_Relationships extends Module {
@@ -55,19 +59,33 @@
55 59 return 'object_id';
56 60 }
57 61
58 62 /**
59 - * The table in the database.
63 + * The table name.
60 64 *
61 65 * @access public
62 66 *
63 67 * @return string
68 + * @deprecated since 3.11.0 Use table() instead.
64 69 */
65 70 public function table_name() {
71 + _deprecated_function( __METHOD__, '3.11.0', 'Automattic\\Jetpack\\Sync\\Term_Relationships->table' );
66 72 return 'term_relationships';
67 73 }
68 74
69 75 /**
76 + * The table in the database with the prefix.
77 + *
78 + * @access public
79 + *
80 + * @return string|bool
81 + */
82 + public function table() {
83 + global $wpdb;
84 + return $wpdb->term_relationships;
85 + }
86 +
87 + /**
70 88 * Initialize term relationships action listeners for full sync.
71 89 *
72 90 * @access public
73 91 *
@@ -163,13 +181,16 @@
163 181 global $wpdb;
164 182
165 183 return $wpdb->get_results(
166 184 $wpdb->prepare(
167 - "SELECT object_id, term_taxonomy_id
168 - FROM $wpdb->term_relationships
169 - WHERE ( object_id = %d AND term_taxonomy_id < %d ) OR ( object_id < %d )
170 - ORDER BY object_id DESC, term_taxonomy_id
171 - DESC LIMIT %d",
185 + "SELECT tr.object_id, tr.term_taxonomy_id
186 + FROM $wpdb->term_relationships tr INNER JOIN $wpdb->term_taxonomy tt
187 + ON tr.term_taxonomy_id=tt.term_taxonomy_id
188 + WHERE " .
189 + Settings::get_whitelisted_taxonomies_sql() // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
190 + . ' AND ( ( tr.object_id = %d AND tr.term_taxonomy_id < %d ) OR ( tr.object_id < %d ) )
191 + ORDER BY tr.object_id DESC, tr.term_taxonomy_id
192 + DESC LIMIT %d',
172 193 $status['last_sent']['object_id'],
173 194 $status['last_sent']['term_taxonomy_id'],
174 195 $status['last_sent']['object_id'],
175 196 $chunk_size