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

Yoast / wordpress-seo / 5066322038

pending completion
5066322038

push

github

GitHub
Merge pull request #20316 from Yoast/JRF/ghactions-run-more-selectively

2550 of 29012 relevant lines covered (8.79%)

0.32 hits per line

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

0.0
/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\Options_Helper;
7
use Yoast\WP\SEO\Integrations\Cleanup_Integration;
8
use Yoast\WP\SEO\Integrations\Integration_Interface;
9

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

15
        use No_Conditionals;
16

17
        /**
18
         * The options helper.
19
         *
20
         * @var Options_Helper
21
         */
22
        private $options_helper;
23

24
        /**
25
         * Activation_Cleanup_Integration constructor.
26
         *
27
         * @param Options_Helper $options_helper The options helper.
28
         */
29
        public function __construct(
30
                Options_Helper $options_helper
31
        ) {
32
                $this->options_helper = $options_helper;
×
33
        }
34

35
        /**
36
         * Registers the action to register a cleanup routine run after the plugin is activated.
37
         *
38
         * @return void
39
         */
40
        public function register_hooks() {
41
                \add_action( 'wpseo_activate', [ $this, 'register_cleanup_routine' ], 11 );
×
42
        }
43

44
        /**
45
         * Registers a run of the cleanup routine if this has not happened yet.
46
         *
47
         * @return void
48
         */
49
        public function register_cleanup_routine() {
50
                $first_activated_on = $this->options_helper->get( 'first_activated_on', false );
×
51

52
                if ( ! $first_activated_on || \time() > ( $first_activated_on + ( \MINUTE_IN_SECONDS * 5 ) ) ) {
×
53
                        if ( ! \wp_next_scheduled( Cleanup_Integration::START_HOOK ) ) {
×
54
                                \wp_schedule_single_event( ( \time() + \DAY_IN_SECONDS ), Cleanup_Integration::START_HOOK );
×
55
                        }
56
                }
57
        }
58
}
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