Merged in feature/MAW-855-import-code-into-aws (pull request #2)
code import from pantheon * code import from pantheon
This commit is contained in:
@@ -106,6 +106,11 @@ class Indexable_Attachment_Watcher implements Integration_Interface {
|
||||
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_COUNT_TRANSIENT );
|
||||
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_LIMITED_COUNT_TRANSIENT );
|
||||
|
||||
// Set this core option (introduced in WP 6.4) to ensure consistency.
|
||||
if ( \get_option( 'wp_attachment_pages_enabled' ) !== false ) {
|
||||
\update_option( 'wp_attachment_pages_enabled', (int) ! $new_value['disable-attachment'] );
|
||||
}
|
||||
|
||||
switch ( $new_value['disable-attachment'] ) {
|
||||
case false:
|
||||
$this->indexing_helper->set_reason( Indexing_Reasons::REASON_ATTACHMENTS_MADE_ENABLED );
|
||||
|
||||
@@ -99,7 +99,8 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_post_types = \array_keys( $this->post_type_helper->get_public_post_types() );
|
||||
$public_post_types = $this->post_type_helper->get_indexable_post_types();
|
||||
|
||||
$last_known_public_post_types = $this->options->get( 'last_known_public_post_types', [] );
|
||||
|
||||
// Initializing the option on the first run.
|
||||
@@ -108,6 +109,7 @@ 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.
|
||||
@@ -122,7 +124,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 ( ! empty( $newly_made_public_post_types ) ) {
|
||||
if ( $newly_made_public_post_types ) {
|
||||
|
||||
// Force a notification requesting to start the SEO data optimization.
|
||||
\delete_transient( Indexable_Post_Indexation_Action::UNINDEXED_COUNT_TRANSIENT );
|
||||
@@ -134,7 +136,7 @@ class Indexable_Post_Type_Change_Watcher implements Integration_Interface {
|
||||
}
|
||||
|
||||
// There are post types that have been made private.
|
||||
if ( ! empty( $newly_made_non_public_post_types ) ) {
|
||||
if ( $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,7 +101,8 @@ class Indexable_Taxonomy_Change_Watcher implements Integration_Interface {
|
||||
return;
|
||||
}
|
||||
|
||||
$public_taxonomies = \array_keys( $this->taxonomy_helper->get_public_taxonomies() );
|
||||
$public_taxonomies = $this->taxonomy_helper->get_indexable_taxonomies();
|
||||
|
||||
$last_known_public_taxonomies = $this->options->get( 'last_known_public_taxonomies', [] );
|
||||
|
||||
// Initializing the option on the first run.
|
||||
@@ -112,6 +113,7 @@ 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