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

Yoast / wordpress-seo / 690a94f3a2f5b90a5eaa9513ba5e3190f1c0d4af

21 May 2025 09:32AM UTC coverage: 52.795% (-0.2%) from 53.032%
690a94f3a2f5b90a5eaa9513ba5e3190f1c0d4af

push

github

web-flow
Merge pull request #22291 from Yoast/feature/llms-txt

Introduce the llms.txt feature

8175 of 14237 branches covered (57.42%)

Branch coverage included in aggregate %.

52 of 406 new or added lines in 31 files covered. (12.81%)

2 existing lines in 2 files now uncovered.

29656 of 57419 relevant lines covered (51.65%)

41580.34 hits per line

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

0.0
/src/llms-txt/application/file/commands/remove-file-command-handler.php
1
<?php
2
// phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded
3
// phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4
namespace Yoast\WP\SEO\Llms_Txt\Application\File\Commands;
5

6
use Yoast\WP\SEO\Helpers\Options_Helper;
7
use Yoast\WP\SEO\Llms_Txt\Infrastructure\File\WordPress_File_System_Adapter;
8
use Yoast\WP\SEO\Llms_Txt\Infrastructure\File\WordPress_Llms_Txt_Permission_Gate;
9

10
/**
11
 * Handles the removal of the llms.txt
12
 */
13
class Remove_File_Command_Handler {
14

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

22
        /**
23
         * The file system adapter.
24
         *
25
         * @var WordPress_File_System_Adapter
26
         */
27
        private $file_system_adapter;
28

29
        /**
30
         * The permission gate.
31
         *
32
         * @var WordPress_Llms_Txt_Permission_Gate $permission_gate
33
         */
34
        private $permission_gate;
35

36
        /**
37
         * Constructor.
38
         *
39
         * @param Options_Helper                     $options_helper      The options helper.
40
         * @param WordPress_File_System_Adapter      $file_system_adapter The file system adapter.
41
         * @param WordPress_Llms_Txt_Permission_Gate $permission_gate     The permission gate.
42
         */
NEW
43
        public function __construct(
×
44
                Options_Helper $options_helper,
45
                WordPress_File_System_Adapter $file_system_adapter,
46
                WordPress_Llms_Txt_Permission_Gate $permission_gate
47
        ) {
NEW
48
                $this->options_helper      = $options_helper;
×
NEW
49
                $this->file_system_adapter = $file_system_adapter;
×
NEW
50
                $this->permission_gate     = $permission_gate;
×
51
        }
52

53
        /**
54
         * Runs the command.
55
         *
56
         * @return void
57
         */
NEW
58
        public function handle() {
×
NEW
59
                if ( $this->permission_gate->is_managed_by_yoast_seo() ) {
×
NEW
60
                        $file_removed = $this->file_system_adapter->remove_file();
×
61

NEW
62
                        if ( $file_removed ) {
×
63
                                // Maybe move this to a class if we need to handle this option more often.
NEW
64
                                \update_option( 'wpseo_llms_txt_content_hash', '' );
×
65
                        }
66
                }
67
        }
68
}
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