Skip to content

Commit

Permalink
Add deprecation tags
Browse files Browse the repository at this point in the history
  • Loading branch information
diedexx committed Nov 16, 2021
1 parent c2d121e commit 38b552d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
21 changes: 7 additions & 14 deletions src/helpers/author-archive-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/helpers/post-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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' );

Expand Down

0 comments on commit 38b552d

Please sign in to comment.