{"record":{"id":"580835d0fee0e453","repo":"flarum/framework","slug":"aborting","errorCode":null,"errorMessage":"Aborting.","messagePattern":"Aborting\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"extensions/audit/src/Console/ClearLogsCommand.php","lineNumber":39,"sourceCode":"    protected $signature = 'audit:clear {--before= : Delete entries older than the specified date. Any Carbon syntax is supported} {--reset : Delete all data, database tables and disable extension} {--force : Don\\'t ask for confirmation}';\n    protected $description = 'Permanently destroy audit log entries';\n\n    public function handle(Connection $db, ExtensionManager $manager): void\n    {\n        if ($before = $this->option('before')) {\n            $beforeDate = Carbon::parse($before);\n\n            $query = AuditLog::query()->where('created_at', '<', $beforeDate);\n            $count = $query->count();\n\n            if ($count === 0) {\n                $this->warn('There are no entries matching this query. Aborting.');\n\n                return;\n            }\n\n            if (! $this->option('force') && ! $this->confirm($count.' records will be deleted from the log table. Continue?')) {\n                $this->warn('Aborting.');\n\n                return;\n            }\n\n            $query->delete();\n            $this->info($count.' records deleted.');\n            $this->info('All done!');\n\n            AuditLogger::log('audit_log_cleared', [\n                'before' => $beforeDate->toIso8601String(),\n                'deleted_count' => $count,\n            ]);\n\n            return;\n        }\n\n        if ($this->option('reset')) {\n            if (! $this->option('force') && ! $this->confirm('This will delete the audit log database table and disable the extension. Continue?')) {","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/extensions/audit/src/Console/ClearLogsCommand.php#L21-L57","documentation":"In ClearLogsCommand, when the user declines the confirmation prompt (and did not pass --force), the command warns 'Aborting.' and returns without deleting the counted records. This is normal interactive cancellation, not a failure.","triggerScenarios":"Running `php flarum clear:logs` with matching records and answering 'no' to the '<count> records will be deleted...' confirm prompt.","commonSituations":"Operator second-guesses a destructive deletion, runs the command non-interactively without --force so the prompt is auto-declined, or CI pipelines that cannot answer prompts.","solutions":["Re-run and answer yes to the confirmation","Pass --force to skip the confirmation prompt","For CI, add --force deliberately after verifying the --before cutoff"],"exampleFix":"// before\nphp flarum clear:logs --before=2026-01-01   # declines prompt\n// after\nphp flarum clear:logs --before=2026-01-01 --force","handlingStrategy":"fallback","validationCode":"if (!posix_isatty(STDIN) && !$force) { // non-interactive: auto-decline or pass --force }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass --force in non-interactive CI contexts deliberately","Preview the count with a read-only query before confirming","Document the confirmation step for operators"],"tags":["cli","confirmation-prompt","aborted-operation"],"backgroundTag":"missing-required-flag","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}