File manager - Edit - /var/www/html/portalHomolog/app/Console/Commands/RollbackImportLicitacoesProcedimentosCommand.php
Back
<?php namespace App\Console\Commands; use App\Http\Services\LicitacaoProcedimentoImportService; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; class RollbackImportLicitacoesProcedimentosCommand extends Command { /** * @var string */ protected $signature = 'licitacoes:rollback-import {--force : Executa sem pedir confirmacao}'; /** * @var string */ protected $description = 'Remove todos os dados importados das tabelas licitacoes_procedimentos e uploads_licitacoes_procedimentos.'; public function handle(LicitacaoProcedimentoImportService $service): int { if ( !$this->option('force') && !$this->confirm('ATENCAO: todos os registros de licitacoes_procedimentos e uploads_licitacoes_procedimentos serao APAGADOS. Deseja continuar?') ) { $this->info('Rollback cancelado.'); return self::SUCCESS; } try { $removed = $service->cleanImportedData(null); Log::channel('import_licitacoes')->info('Rollback executado.', [ 'uploads_removidos' => $removed['uploads'], 'processos_removidos' => $removed['processos'], ]); $this->info("Tabela uploads_licitacoes_procedimentos limpa ({$removed['uploads']} registros removidos)."); $this->info("Tabela licitacoes_procedimentos limpa ({$removed['processos']} registros removidos)."); $this->info('Arquivo de mapa de IDs removido (se existia).'); $this->newLine(); $this->info('Rollback concluido com sucesso!'); return self::SUCCESS; } catch (\Throwable $e) { $this->error('Rollback falhou: ' . $e->getMessage()); Log::channel('import_licitacoes')->error('Rollback falhou.', ['error' => $e->getMessage()]); return self::FAILURE; } } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings