• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / wordpress-seo / d0576c9d7b9d3bb14e757d43db2e5deceb39bba3

27 Oct 2025 12:02PM UTC coverage: 52.599% (-0.09%) from 52.692%
d0576c9d7b9d3bb14e757d43db2e5deceb39bba3

Pull #22675

github

web-flow
Merge 4c38ba824 into 337402506
Pull Request #22675: 804 add caching

8147 of 15270 branches covered (53.35%)

Branch coverage included in aggregate %.

0 of 146 new or added lines in 5 files covered. (0.0%)

56 existing lines in 2 files now uncovered.

31468 of 60045 relevant lines covered (52.41%)

39772.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/nlweb/schema-aggregator/user-interface/site-schema-aggregator-cache-cli-command.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong -- Needed in the folder structure.
3
namespace Yoast\WP\SEO\Nlweb\Schema_Aggregator\User_Interface;
4

5
use WP_CLI;
6
use WP_CLI\ExitException;
7
use Yoast\WP\SEO\Commands\Command_Interface;
8
use Yoast\WP\SEO\Main;
9
use Yoast\WP\SEO\Nlweb\Schema_Aggregator\Application\Cache\Manager;
10
use Yoast\WP\SEO\Nlweb\Schema_Aggregator\Infrastructure\Config;
11

12
/**
13
 * Handles the CLI command to represent a site's schema as JSON.
14
 *
15
 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
16
 */
17
class Site_Schema_Aggregator_Cache_Cli_Command implements Command_Interface {
18

19
        /**
20
         * The configuration instance.
21
         *
22
         * @var Config
23
         */
24
        private $config;
25

26
        /**
27
         * The The cache manager instance.
28
         *
29
         * @var Manager
30
         */
31
        private $cache_manager;
32

33
        /**
34
         * Site_Schema_Aggregator_Cache_Cli_Command constructor.
35
         *
36
         * @param Config  $config        The config object.
37
         * @param Manager $cache_manager The cache manager.
38
         */
NEW
39
        public function __construct( Config $config, Manager $cache_manager ) {
×
NEW
40
                $this->config        = $config;
×
NEW
41
                $this->cache_manager = $cache_manager;
×
42
        }
43

44
        /**
45
         * Returns the namespace of this command.
46
         *
47
         * @return string
48
         */
NEW
49
        public static function get_namespace() {
×
NEW
50
                return Main::WP_CLI_NAMESPACE;
×
51
        }
52

53
        /**
54
         * Aggregates the schema for a certain site.
55
         *
56
         * ## OPTIONS
57
         *
58
         * [--page=<page>]
59
         * : The current page to process.
60
         * ---
61
         * ## EXAMPLES
62
         *
63
         *     wp yoast aggregate_site_schema_clear_cache
64
         *
65
         * @when after_wp_load
66
         *
67
         * @param array<string>|null $args       The arguments.
68
         * @param array<string>|null $assoc_args The associative arguments.
69
         *
70
         * @throws ExitException When the input args are invalid.
71
         * @return void
72
         */
NEW
73
        public function aggregate_site_schema_clear_cache( $args = null, $assoc_args = null ) {
×
NEW
74
                if ( isset( $assoc_args['page'] ) && (int) $assoc_args['page'] >= 1 ) {
×
NEW
75
                        $this->cache_manager->invalidate( $assoc_args['page'] );
×
NEW
76
                        WP_CLI::log(
×
NEW
77
                                \__( 'The site schema cache has been cleared successfully.', 'wordpress-seo' )
×
NEW
78
                        );
×
NEW
79
                        return;
×
80
                }
NEW
81
                $this->cache_manager->invalidate_all();
×
82

NEW
83
                WP_CLI::log(
×
NEW
84
                        \__( 'All site schema cache has been cleared successfully.', 'wordpress-seo' )
×
NEW
85
                );
×
86
        }
87
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc