plugin updates

This commit is contained in:
Tony Volpe
2024-10-24 12:57:16 -04:00
parent 8217f0dbed
commit 5e040c9234
399 changed files with 3377 additions and 46318 deletions

View File

@@ -57,7 +57,7 @@ abstract class Abstract_Indexing_Action implements Indexation_Action_Interface,
$query = $this->get_select_query( $limit );
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Function get_count_query returns a prepared query.
$unindexed_object_ids = $this->wpdb->get_col( $query );
$unindexed_object_ids = ( $query === '' ) ? [] : $this->wpdb->get_col( $query );
$count = (int) \count( $unindexed_object_ids );
\set_transient( static::UNINDEXED_LIMITED_COUNT_TRANSIENT, $count, ( \MINUTE_IN_SECONDS * 15 ) );
@@ -83,7 +83,7 @@ abstract class Abstract_Indexing_Action implements Indexation_Action_Interface,
$query = $this->get_count_query();
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Function get_count_query returns a prepared query.
$count = $this->wpdb->get_var( $query );
$count = ( $query === '' ) ? 0 : $this->wpdb->get_var( $query );
if ( \is_null( $count ) ) {
return false;

View File

@@ -83,7 +83,7 @@ class Indexable_Term_Indexation_Action extends Abstract_Indexing_Action {
$query = $this->get_select_query( $this->get_limit() );
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Function get_select_query returns a prepared query.
$term_ids = $this->wpdb->get_col( $query );
$term_ids = ( $query === '' ) ? [] : $this->wpdb->get_col( $query );
$indexables = [];
foreach ( $term_ids as $term_id ) {
@@ -128,6 +128,10 @@ class Indexable_Term_Indexation_Action extends Abstract_Indexing_Action {
$taxonomy_table = $this->wpdb->term_taxonomy;
$public_taxonomies = $this->taxonomy->get_indexable_taxonomies();
if ( empty( $public_taxonomies ) ) {
return '';
}
$taxonomies_placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) );
$replacements = [ $this->version ];
@@ -159,7 +163,12 @@ class Indexable_Term_Indexation_Action extends Abstract_Indexing_Action {
$indexable_table = Model::get_table_name( 'Indexable' );
$taxonomy_table = $this->wpdb->term_taxonomy;
$public_taxonomies = $this->taxonomy->get_indexable_taxonomies();
$placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) );
if ( empty( $public_taxonomies ) ) {
return '';
}
$placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) );
$replacements = [ $this->version ];
\array_push( $replacements, ...$public_taxonomies );

View File

@@ -52,6 +52,10 @@ class Term_Link_Indexing_Action extends Abstract_Link_Indexing_Action {
protected function get_objects() {
$query = $this->get_select_query( $this->get_limit() );
if ( $query === '' ) {
return [];
}
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Function get_select_query returns a prepared query.
$terms = $this->wpdb->get_results( $query );
@@ -74,8 +78,13 @@ class Term_Link_Indexing_Action extends Abstract_Link_Indexing_Action {
*/
protected function get_count_query() {
$public_taxonomies = $this->taxonomy_helper->get_indexable_taxonomies();
$placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) );
$indexable_table = Model::get_table_name( 'Indexable' );
if ( empty( $public_taxonomies ) ) {
return '';
}
$placeholders = \implode( ', ', \array_fill( 0, \count( $public_taxonomies ), '%s' ) );
$indexable_table = Model::get_table_name( 'Indexable' );
// Warning: If this query is changed, makes sure to update the query in get_select_query as well.
return $this->wpdb->prepare(
@@ -102,6 +111,10 @@ class Term_Link_Indexing_Action extends Abstract_Link_Indexing_Action {
protected function get_select_query( $limit = false ) {
$public_taxonomies = $this->taxonomy_helper->get_indexable_taxonomies();
if ( empty( $public_taxonomies ) ) {
return '';
}
$indexable_table = Model::get_table_name( 'Indexable' );
$replacements = $public_taxonomies;