rebase code on oct-10-2023
This commit is contained in:
@@ -99,8 +99,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_post_types = $this->post_type_helper->get_indexable_post_types();
|
||||
|
||||
$public_post_types = \array_keys( $this->post_type_helper->get_public_post_types() );
|
||||
$last_known_public_post_types = $this->options->get( 'last_known_public_post_types', [] );
|
||||
|
||||
// Initializing the option on the first run.
|
||||
@@ -109,7 +108,6 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// We look for new public post types.
|
||||
$newly_made_public_post_types = \array_diff( $public_post_types, $last_known_public_post_types );
|
||||
// We look for post types that from public have been made private.
|
||||
@@ -124,7 +122,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
$this->options->set( 'last_known_public_post_types', $public_post_types );
|
||||
|
||||
// There are new post types that have been made public.
|
||||
if ( $newly_made_public_post_types ) {
|
||||
if ( ! empty( $newly_made_public_post_types ) ) {
|
||||
|
||||
// Force a notification requesting to start the SEO data optimization.
|
||||
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_COUNT_TRANSIENT );
|
||||
@@ -136,7 +134,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
}
|
||||
|
||||
// There are post types that have been made private.
|
||||
if ( $newly_made_non_public_post_types ) {
|
||||
if ( ! empty( $newly_made_non_public_post_types ) ) {
|
||||
// Schedule a cron job to remove all the posts whose post type has been made private.
|
||||
$cleanup_not_yet_scheduled = ! \wp_next_scheduled( Cleanup_Integration::START_HOOK );
|
||||
if ( $cleanup_not_yet_scheduled ) {
|
||||
|
||||
@@ -101,8 +101,7 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_taxonomies = $this->taxonomy_helper->get_indexable_taxonomies();
|
||||
|
||||
$public_taxonomies = \array_keys( $this->taxonomy_helper->get_public_taxonomies() );
|
||||
$last_known_public_taxonomies = $this->options->get( 'last_known_public_taxonomies', [] );
|
||||
|
||||
// Initializing the option on the first run.
|
||||
@@ -113,7 +112,6 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
|
||||
|
||||
// We look for new public taxonomies.
|
||||
$newly_made_public_taxonomies = \array_diff( $public_taxonomies, $last_known_public_taxonomies );
|
||||
|
||||
// We look fortaxonomies that from public have been made private.
|
||||
$newly_made_non_public_taxonomies = \array_diff( $last_known_public_taxonomies, $public_taxonomies );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user