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

Yoast / wordpress-seo / 481faf637ba3a7c1e5f2bfef59b582ac39523de6

21 May 2025 09:11AM UTC coverage: 46.174%. First build
481faf637ba3a7c1e5f2bfef59b582ac39523de6

Pull #22291

github

web-flow
Merge pull request #22278 from Yoast/577-sanitize-and-deal-with-special-markdown-characters-before-writing-to-file

577 sanitize and deal with special markdown characters before writing to file
Pull Request #22291: Introduce the llms.txt feature

52 of 403 new or added lines in 30 files covered. (12.9%)

15586 of 33755 relevant lines covered (46.17%)

3.67 hits per line

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

0.0
/src/llms-txt/user-interface/cleanup-llms-txt-on-deactivation.php
1
<?php
2

3
namespace Yoast\WP\SEO\Llms_Txt\User_Interface;
4

5
use Yoast\WP\SEO\Conditionals\No_Conditionals;
6
use Yoast\WP\SEO\Integrations\Integration_Interface;
7
use Yoast\WP\SEO\Llms_Txt\Application\File\Commands\Remove_File_Command_Handler;
8
use Yoast\WP\SEO\Llms_Txt\Application\File\Llms_Txt_Cron_Scheduler;
9

10
/**
11
 * Trys to clean up the llms.txt file when the plugin is deactivated.
12
 */
13
class Cleanup_Llms_Txt_On_Deactivation implements Integration_Interface {
14

15
        use No_Conditionals;
16

17
        /**
18
         * The command handler.
19
         *
20
         * @var Remove_File_Command_Handler
21
         */
22
        private $command_handler;
23

24
        /**
25
         * The cron scheduler.
26
         *
27
         * @var Llms_Txt_Cron_Scheduler
28
         */
29
        private $cron_scheduler;
30

31
        /**
32
         * Constructor.
33
         *
34
         * @param Remove_File_Command_Handler $command_handler The command handler.
35
         * @param Llms_Txt_Cron_Scheduler     $cron_scheduler  The scheduler.
36
         */
NEW
37
        public function __construct(
×
38
                Remove_File_Command_Handler $command_handler,
39
                Llms_Txt_Cron_Scheduler $cron_scheduler
40
        ) {
NEW
41
                $this->command_handler = $command_handler;
×
NEW
42
                $this->cron_scheduler  = $cron_scheduler;
×
43
        }
44

45
        /**
46
         * Registers the unscheduling of the cron to the deactivation action.
47
         *
48
         * @return void
49
         */
NEW
50
        public function register_hooks() {
×
NEW
51
                \add_action( 'wpseo_deactivate', [ $this, 'maybe_remove_llms_file' ] );
×
52
        }
53

54
        /**
55
         * Call the command handler to remove the file.
56
         *
57
         * @return void
58
         */
NEW
59
        public function maybe_remove_llms_file(): void {
×
NEW
60
                $this->command_handler->handle();
×
NEW
61
                $this->cron_scheduler->unschedule_llms_txt_population();
×
62
        }
63
}
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