← All changes
|
src/integrations/admin/admin-columns-cache-integration.php
+10
-2
18.4
→
28.5
View file →
| @@ -52,8 +52,10 @@ | ||
| 52 | 52 | * indexables on admin pages. |
| 53 | 53 | * |
| 54 | 54 | * This cache is used in showing the Yoast SEO columns on the posts overview |
| 55 | 55 | * page (e.g. keyword score, incoming link count, etc.) |
| 56 | + * | |
| 57 | + * @return void | |
| 56 | 58 | */ |
| 57 | 59 | public function register_hooks() { |
| 58 | 60 | // Hook into tablenav to calculate links and linked. |
| 59 | 61 | \add_action( 'manage_posts_extra_tablenav', [ $this, 'maybe_fill_cache' ] ); |
| @@ -62,8 +64,10 @@ | ||
| 62 | 64 | /** |
| 63 | 65 | * Makes sure we calculate all values in one query by filling our cache beforehand. |
| 64 | 66 | * |
| 65 | 67 | * @param string $target Extra table navigation location which is triggered. |
| 68 | + * | |
| 69 | + * @return void | |
| 66 | 70 | */ |
| 67 | 71 | public function maybe_fill_cache( $target ) { |
| 68 | 72 | if ( $target === 'top' ) { |
| 69 | 73 | $this->fill_cache(); |
| @@ -71,8 +75,10 @@ | ||
| 71 | 75 | } |
| 72 | 76 | |
| 73 | 77 | /** |
| 74 | 78 | * Fills the cache of indexables for all known post IDs. |
| 79 | + * | |
| 80 | + * @return void | |
| 75 | 81 | */ |
| 76 | 82 | public function fill_cache() { |
| 77 | 83 | global $wp_query; |
| 78 | 84 | |
| @@ -108,9 +114,11 @@ | ||
| 108 | 114 | |
| 109 | 115 | $indexables = $this->indexable_repository->find_by_multiple_ids_and_type( $post_ids, 'post', false ); |
| 110 | 116 | |
| 111 | 117 | foreach ( $indexables as $indexable ) { |
| 112 | - $this->indexable_cache[ $indexable->object_id ] = $indexable; | |
| 118 | + if ( $indexable instanceof Indexable ) { | |
| 119 | + $this->indexable_cache[ $indexable->object_id ] = $indexable; | |
| 120 | + } | |
| 113 | 121 | } |
| 114 | 122 | } |
| 115 | 123 | |
| 116 | 124 | /** |
| @@ -167,9 +175,9 @@ | ||
| 167 | 175 | } |
| 168 | 176 | $pages_map[ $page->ID ] = $page; |
| 169 | 177 | } |
| 170 | 178 | |
| 171 | - $pages = &$top_level_pages; | |
| 179 | + $pages = $top_level_pages; | |
| 172 | 180 | } |
| 173 | 181 | |
| 174 | 182 | $count = 0; |
| 175 | 183 | $start = ( ( $pagenum - 1 ) * $per_page ); |