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

Yoast / wordpress-seo / b961a40c4e03131cc8c75ccf8d5090e5e16f19f9

05 Jul 2024 01:16PM UTC coverage: 54.068% (+5.4%) from 48.645%
b961a40c4e03131cc8c75ccf8d5090e5e16f19f9

push

github

mhkuu
Merge branch 'trunk' of github.com:Yoast/wordpress-seo into feature/fix-assessments

7451 of 13463 branches covered (55.34%)

Branch coverage included in aggregate %.

287 of 380 new or added lines in 34 files covered. (75.53%)

1 existing line in 1 file now uncovered.

29380 of 54657 relevant lines covered (53.75%)

61031.68 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(
×
39
                Options_Helper $options_helper,
40
                Indexable_Helper $indexable_helper
41
        ) {
NEW
42
                $this->options_helper   = $options_helper;
×
NEW
43
                $this->indexable_helper = $indexable_helper;
×
44
        }
45

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

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

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