Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Indexable visibility columns #17757

Open
wants to merge 58 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b3fd2cd
Ensure array return type
diedexx Nov 12, 2021
87c11c3
Allow for deprecating columns
diedexx Nov 12, 2021
2eef6e2
Add method for creating a noindex query for indexables
diedexx Nov 15, 2021
b5bc8db
Rename is_public to is_publicly_viewable and number_of_public_posts t…
diedexx Nov 15, 2021
6c015ba
Use PHP 5.6 syntax
diedexx Nov 16, 2021
3d96968
Add migrations
diedexx Nov 16, 2021
acdf97a
Deprecate is_public instead of immediately replacing it
diedexx Nov 16, 2021
e18c9ac
Keep the method name the same and deprecate
diedexx Nov 16, 2021
58d6a71
Access properties that were renamed earlier
diedexx Nov 16, 2021
b7cfa04
Make the homepage get a number_of_publicly_viewable_posts and is_publ…
diedexx Nov 16, 2021
c2d121e
Use new column name
diedexx Nov 16, 2021
38b552d
Add deprecation tags
diedexx Nov 16, 2021
2fdce2f
Fix cs
diedexx Nov 16, 2021
3a18f72
Mark enabled date archives as publicly viewable
diedexx Nov 26, 2021
5e89640
Delegate logic to central helper
diedexx Nov 26, 2021
0a38f49
Make global namespace usage explicit
diedexx Nov 26, 2021
81e7421
Flip argument order
diedexx Nov 26, 2021
1564f53
Allow for considering empty archives as indexed
diedexx Nov 26, 2021
ecae28e
Update deperatation based on the expected release version
diedexx Nov 26, 2021
ea0a46e
Prevent new integrators from accessing is_public
diedexx Nov 26, 2021
6ccacd5
Update tests
diedexx Nov 26, 2021
ccf7f9b
Remove resolved todo comment
diedexx Nov 26, 2021
af7b219
Rebuild date archive indexable when disabling date archives
diedexx Nov 26, 2021
510f9de
Fix cs
diedexx Nov 26, 2021
ed46abb
Prevent deprecation warnings when (re)indexing
diedexx Nov 26, 2021
ff247f9
Include password protected posts in aggegrate queries
diedexx Nov 30, 2021
ca85a07
Keep the most recent last modified date.
diedexx Nov 30, 2021
faf1180
Merge branch 'trunk' of https://github.com/Yoast/wordpress-seo into F…
diedexx Nov 30, 2021
f6a8adf
Adhere to naming conventions
diedexx Dec 2, 2021
274df53
Don't hardcode the deprecation version number
diedexx Dec 2, 2021
d51829e
Update deprecation versions and descriptions
diedexx Dec 2, 2021
5c1193a
Rename migration
diedexx Dec 2, 2021
661e9a3
Merge branch 'trunk' of https://github.com/Yoast/wordpress-seo into F…
diedexx Dec 3, 2021
82f8a78
Fix cs
diedexx Dec 3, 2021
66d6e4d
Update tests
diedexx Dec 3, 2021
cf56df4
Fill WP 5.7 function
diedexx Dec 3, 2021
68aba31
Mock calls to newly introduced functions
diedexx Dec 3, 2021
3329a1b
Polyfill WP 5.7 function
diedexx Dec 3, 2021
e906ace
Lower error threshold
diedexx Dec 3, 2021
29739ee
Remove unused function that never made it into trunk
diedexx Dec 3, 2021
66c9433
Remove test double funtion that was removed in its parent
diedexx Dec 6, 2021
9eb9263
Make global namespace explicit
diedexx Dec 7, 2021
0c9ac1a
Ensure that post_types is an array
diedexx Dec 7, 2021
2059186
Automatically update date-archive indexables
diedexx Dec 7, 2021
b95492e
Use the type of the originally requested property in case of replaced…
diedexx Dec 10, 2021
101edcf
Merge branch 'trunk' of https://github.com/Yoast/wordpress-seo into F…
diedexx Dec 10, 2021
5d095a5
Fix CS warnings and errors
diedexx Dec 10, 2021
d8f754f
Fix tests
diedexx Dec 10, 2021
f613dfc
Clarify that the comment is about a function
diedexx Dec 17, 2021
3e7e755
Add instructions to remove related code
diedexx Dec 17, 2021
c24488e
Reduce risk of using the same builder version twice.
diedexx Dec 17, 2021
4ed8b38
Update post relation indexables when a post is set to private
diedexx Dec 17, 2021
275c423
Fix cs
diedexx Dec 18, 2021
08c1f5f
Fix precedence issues in query
diedexx Dec 19, 2021
e1c5055
Merge branch 'trunk' of https://github.com/Yoast/wordpress-seo into F…
diedexx Dec 20, 2021
6cf15bf
Increase threhshold
diedexx Dec 20, 2021
bad2929
Exclude password protected posts from the publicly_viewable_count
diedexx Dec 21, 2021
148d47c
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into FIX-22-nu…
Dec 30, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add deprecation tags
  • Loading branch information
diedexx committed Nov 16, 2021
commit 38b552db0c80d39c7e123ea124cc8f9517ef48f2
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