File manager - Edit - /var/www/html/homologBancodetalentos/app/Support/TalentBank/LegacySqlDumpSession.php
Back
<?php namespace App\Support\TalentBank; use RuntimeException; /** * Importa um dump .sql uma única vez e expõe a conexão mysql_bt_legacy * para dry-run e legacy-migrate sem reimportar o arquivo. */ class LegacySqlDumpSession { public const LEGACY_CONNECTION = 'mysql_bt_legacy'; private ?LegacySqlDumpImporter $importer = null; public function __construct( private string $sqlPath, ) { } public function sqlPath(): string { return $this->sqlPath; } public function isImported(): bool { return $this->importer !== null && $this->importer->isImported(); } /** * @param callable|null $progress fn(string $step, string $message): void */ public function ensureImported(?callable $progress = null): void { if ($this->isImported()) { return; } $this->importer = new LegacySqlDumpImporter( sqlPath: $this->sqlPath, dropAfter: false, ); $this->importer->import($progress); } public function legacyConnection(): string { return self::LEGACY_CONNECTION; } public function cleanup(): void { $this->importer?->cleanup(true); $this->importer = null; } public static function resolvePath(?string $path): string { if (! is_string($path) || trim($path) === '') { throw new RuntimeException( 'Caminho do dump SQL não informado. Use --sql-dump= ou TALENT_BANK_LEGACY_SQL_DUMP no .env.' ); } $rp = trim($path); $isAbsolute = str_starts_with($rp, '/') || preg_match('#^[A-Za-z]:[/\\\\]#', $rp); return $isAbsolute ? $rp : base_path(str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $rp)); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings