file_system_adapter = $file_system_adapter; $this->options_helper = $options_helper; } /** * Checks if Yoast SEO manages the llms.txt. * * @return bool Checks if Yoast SEO manages the llms.txt. */ public function is_managed_by_yoast_seo(): bool { $stored_hash = \get_option( Populate_File_Command_Handler::CONTENT_HASH_OPTION, '' ); // If the file does not exist yet, we always regenerate/create it. if ( ! $this->file_system_adapter->file_exists() ) { return true; } // This means the file is already there (maybe hand made or another plugin created it). And since we don't have a hash it's not ours. if ( $stored_hash === '' ) { return false; } $current_content = $this->file_system_adapter->get_file_contents(); // If you have a hash, we want to make sure it's the same. This check makes sure the file is not edited by the user. return \md5( $current_content ) === $stored_hash; } }