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

Yoast / wordpress-seo / 7004843404

27 Nov 2023 11:48AM UTC coverage: 49.206% (-0.03%) from 49.232%
7004843404

push

github

web-flow
Merge pull request #20858 from Yoast/improve-copy-in-the-ftc-57

15305 of 31104 relevant lines covered (49.21%)

4.03 hits per line

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

81.82
/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() {
2✔
41
                \add_action( 'wpseo_activate', [ $this, 'register_cleanup_routine' ], 11 );
2✔
42
        }
1✔
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() {
6✔
50
                $first_activated_on = $this->options_helper->get( 'first_activated_on', false );
6✔
51

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

© 2025 Coveralls, Inc