phpvms/modules/Importer/Console/Commands/ImportFromClassicCommand.php
Nabeel S e862537a20
Split the importer module out from the installer module (#468)
* Split the importer module out from the installer module

* Cleanup of unused imports

* Move updater into separate module #453

* Remove unused imports/formatting

* Disable the install and importer modules at the end of the setup

* Unused imports; update IJ style

* test explicit stage for php+mysql

* add more to matrix

* Add different MariaDB versions

* undo
2019-12-12 15:07:35 -05:00

41 lines
1.2 KiB
PHP

<?php
namespace Modules\Importer\Console\Commands;
use App\Contracts\Command;
use Illuminate\Support\Facades\Log;
use Modules\Importer\Services\ImporterService;
class ImportFromClassicCommand extends Command
{
protected $signature = 'phpvms:importer {db_host} {db_name} {db_user} {db_pass?} {table_prefix=phpvms_}';
protected $description = 'Import from an older version of phpVMS';
/**
* Run dev related commands
*/
public function handle()
{
$creds = [
'host' => $this->argument('db_host'),
'name' => $this->argument('db_name'),
'user' => $this->argument('db_user'),
'pass' => $this->argument('db_pass'),
'table_prefix' => $this->argument('table_prefix'),
];
$importerSvc = new ImporterService();
$importerSvc->saveCredentials($creds);
$manifest = $importerSvc->generateImportManifest();
foreach ($manifest as $record) {
try {
$importerSvc->run($record['importer'], $record['start']);
} catch (\Exception $e) {
Log::error($e->getMessage());
}
}
}
}