array( 'type' => 'string', 'enum' => array( 'essentials', 'basic', 'advanced', 'aggressive', 'extreme' ), 'description' => __( 'Which preset to apply.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'preset', ); } protected function output_properties(): array { return array( 'preset' => array( 'type' => 'string' ), 'backups' => array( 'type' => 'array' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => false, 'idempotent' => false, ); } protected function requires_confirmation(): bool { return true; } protected function confirmation_message(): string { return __( 'Applying a preset replaces the entire LiteSpeed configuration. A backup is taken first and can be restored with litespeed/restore-preset-backup. Pass confirm: true to proceed.', 'acrossai-abilities-manager' ); } protected function run( array $input ) { $preset = isset( $input['preset'] ) ? (string) $input['preset'] : ''; $applied = Toolbox_Repository::apply_preset( $preset ); if ( is_wp_error( $applied ) ) { return $applied; } return array( 'preset' => $preset, 'backups' => Toolbox_Repository::backups(), 'message' => sprintf( /* translators: %s: preset name */ __( 'Applied the "%s" preset. A backup was taken first — see litespeed/list-preset-backups. Test the front end now.', 'acrossai-abilities-manager' ), $preset ), ); } }