setName('mobile-recording:cleanup')->setDescription('清理无数据库引用且超过一天的私有录音孤儿文件') ->addOption('dry-run', null, Option::VALUE_NONE, '只统计,不删除'); } protected function execute(Input $input, Output $output): int { try { $result = MobileRecordingStorage::cleanupOrphans((bool) $input->getOption('dry-run')); $output->writeln('MOBILE_RECORDING_CLEANUP ' . json_encode($result)); return $result['errors'] > 0 ? 1 : 0; } catch (\Throwable $e) { $output->writeln('MOBILE_RECORDING_CLEANUP storage_or_configuration_error'); return 1; } } }