add_options(); self::generate_llms_txt( $plugin_settings ); self::update_installation_state_on_activation(); } /** * The generator's own self-heal on `init` only runs for a logged-in administrator, so a site * provisioned headlessly would serve no llms.txt until someone opened wp-admin. */ private static function generate_llms_txt( PluginSettings $plugin_settings ): void { $file_helper = new LlmsTxtFileHelper(); if ( $file_helper->llmstxt_file_exists() ) { return; } $llms_txt_parser = new LlmsTxtParser( new LlmsTxtSummaryProvider() ); $generator = new LlmsTxtGenerator( $plugin_settings, $file_helper, $llms_txt_parser ); $generator->generate(); } /** * Saves installation state. * * @return void */ public static function update_installation_state_on_activation(): void { $installation_state = get_option( self::INSTALLATION_OPTION_NAME, false ); if ( $installation_state !== 'old' ) { add_option( self::INSTALLATION_OPTION_NAME, 'new' ); } } }