From 38b552db0c80d39c7e123ea124cc8f9517ef48f2 Mon Sep 17 00:00:00 2001 From: Diede Exterkate Date: Tue, 16 Nov 2021 11:18:00 +0100 Subject: [PATCH] Add deprecation tags --- src/helpers/author-archive-helper.php | 21 +++++++-------------- src/helpers/post-helper.php | 6 +++--- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/helpers/author-archive-helper.php b/src/helpers/author-archive-helper.php index fe0f3e04b0f..3a5f4276098 100644 --- a/src/helpers/author-archive-helper.php +++ b/src/helpers/author-archive-helper.php @@ -42,28 +42,17 @@ public function get_author_archive_post_types() { return \apply_filters( 'wpseo_author_archive_post_types', [ 'post' ] ); } - /** - * Gets the number of public posts an author has. - * Depends on the post indexables to be fully indexed. - * - * @param int $author_id The id of the author to get the number of public posts for. - * - * @return int The number of public posts an author has. - */ - public function get_number_of_public_posts( $author_id ) { - $author_indexable = $this->indexable_repository->find_by_id_and_type( $author_id, 'user' ); - - return $author_indexable->number_of_public_posts; - } - /** * Returns whether the author has at least one public post. * * @param int $author_id The author ID. * * @return bool|null Whether the author has at least one public post. + * + * @deprecated 17.7 */ public function author_has_public_posts( $author_id ) { + _deprecated_function( __METHOD__, '17.7',Indexable_Repository::class.'::noindex_query'); // First check if the author has at least one public post. $has_public_post = $this->author_has_a_public_post( $author_id ); if ( $has_public_post ) { @@ -87,6 +76,8 @@ public function author_has_public_posts( $author_id ) { * @param int $author_id The author ID. * * @return bool Whether the author has at least one public post. + * + * @deprecated 17.7 */ protected function author_has_a_public_post( $author_id ) { $cache_key = 'author_has_a_public_post_' . $author_id; @@ -118,6 +109,8 @@ protected function author_has_a_public_post( $author_id ) { * @param int $author_id The author ID. * * @return bool Whether the author has at least one post with the is public null. + * + * @deprecated 17.7 */ protected function author_has_a_post_with_is_public_null( $author_id ) { $cache_key = 'author_has_a_post_with_is_public_null_' . $author_id; diff --git a/src/helpers/post-helper.php b/src/helpers/post-helper.php index daf5c997be1..8419851c38b 100644 --- a/src/helpers/post-helper.php +++ b/src/helpers/post-helper.php @@ -136,7 +136,7 @@ public function get_post( $post_id ) { } /** - * Updates the number_of_public_posts field on attachments for a post_parent. + * Updates the number_of_publicly_viewable_posts field on attachments for a post_parent. * * An attachment is represented by their post parent when: * - The attachment has a post parent. @@ -145,13 +145,13 @@ public function get_post( $post_id ) { * @codeCoverageIgnore It relies too much on dependencies. * * @param int $post_parent Post ID. - * @param int $number_of_public_posts The number of public posts + * @param int $has_public_posts Unused. * * @return bool Whether the update was successful. * * @deprecated 17.7 */ - public function update_has_public_posts_on_attachments( $post_parent, $number_of_public_posts ) { + public function update_has_public_posts_on_attachments( $post_parent, $has_public_posts ) { _deprecated_function( __METHOD__, '17.7' ); $indexable = $this->repository->find_by_id_and_type( $post_parent, 'post' );