Installing and managing modules from admin panel (#847)
This commit is contained in:
40
app/Console/Commands/ImportFromClassicCommand.php
Normal file
40
app/Console/Commands/ImportFromClassicCommand.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Contracts\Command;
|
||||
use App\Services\ImporterService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user