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

Yoast / wordpress-seo / f44229b0911ab3251ebf3aec976097d0ed682dee

24 Mar 2025 06:25PM UTC coverage: 48.68% (-0.03%) from 48.71%
f44229b0911ab3251ebf3aec976097d0ed682dee

push

github

web-flow
Merge pull request #22139 from Yoast/JRF/CSQA/remove-unused-use-statements

CS/QA: remove unused import use statements

16083 of 33038 relevant lines covered (48.68%)

3.61 hits per line

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

78.57
/src/integrations/admin/activation-cleanup-integration.php
1
<?php
2

3
namespace Yoast\WP\SEO\Integrations\Admin;
4

5
use Yoast\WP\SEO\Conditionals\No_Conditionals;
6
use Yoast\WP\SEO\Helpers\Indexable_Helper;
7
use Yoast\WP\SEO\Helpers\Options_Helper;
8
use Yoast\WP\SEO\Integrations\Cleanup_Integration;
9
use Yoast\WP\SEO\Integrations\Integration_Interface;
10

11
/**
12
 * This integration registers a run of the cleanup routine whenever the plugin is activated.
13
 */
14
class Activation_Cleanup_Integration implements Integration_Interface {
15

16
        use No_Conditionals;
17

18
        /**
19
         * The indexable helper.
20
         *
21
         * @var Indexable_Helper
22
         */
23
        protected $indexable_helper;
24

25
        /**
26
         * The options helper.
27
         *
28
         * @var Options_Helper
29
         */
30
        private $options_helper;
31

32
        /**
33
         * Activation_Cleanup_Integration constructor.
34
         *
35
         * @param Options_Helper   $options_helper   The options helper.
36
         * @param Indexable_Helper $indexable_helper The indexable helper.
37
         */
38
        public function __construct( Options_Helper $options_helper, Indexable_Helper $indexable_helper ) {
×
39
                $this->options_helper   = $options_helper;
×
40
                $this->indexable_helper = $indexable_helper;
×
41
        }
42

43
        /**
44
         * Registers the action to register a cleanup routine run after the plugin is activated.
45
         *
46
         * @return void
47
         */
48
        public function register_hooks() {
2✔
49
                \add_action( 'wpseo_activate', [ $this, 'register_cleanup_routine' ], 11 );
2✔
50
        }
1✔
51

52
        /**
53
         * Registers a run of the cleanup routine if this has not happened yet.
54
         *
55
         * @return void
56
         */
57
        public function register_cleanup_routine() {
8✔
58
                if ( ! $this->indexable_helper->should_index_indexables() ) {
8✔
59
                        return;
2✔
60
                }
61
                $first_activated_on = $this->options_helper->get( 'first_activated_on', false );
6✔
62

63
                if ( ! $first_activated_on || \time() > ( $first_activated_on + ( \MINUTE_IN_SECONDS * 5 ) ) ) {
6✔
64
                        if ( ! \wp_next_scheduled( Cleanup_Integration::START_HOOK ) ) {
4✔
65
                                \wp_schedule_single_event( ( \time() + \DAY_IN_SECONDS ), Cleanup_Integration::START_HOOK );
2✔
66
                        }
67
                }
68
        }
3✔
69
}
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