@@ -64,32 +64,32 @@ EOT
|
||||
}
|
||||
}
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:database:create');
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:database:create');
|
||||
$command->run(new ArrayInput([]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to create database: ' . $ex->getMessage());
|
||||
return 1;
|
||||
}
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:schema:drop');
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:schema:drop');
|
||||
$command->run(new ArrayInput(['--force' => true]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to drop database schema: ' . $ex->getMessage());
|
||||
return 2;
|
||||
}
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:schema:create');
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:schema:create');
|
||||
$command->run(new ArrayInput([]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to create database schema: ' . $ex->getMessage());
|
||||
return 3;
|
||||
}
|
||||
|
||||
$command = $this->getApplication()->find('doctrine:fixtures:load');
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:fixtures:load');
|
||||
$cmdInput = new ArrayInput([]);
|
||||
$cmdInput->setInteractive(false);
|
||||
$command->run($cmdInput, $output);
|
||||
|
||||
@@ -59,34 +59,42 @@ class InstallCommand extends Command
|
||||
];
|
||||
}
|
||||
|
||||
$this->installAssets($output, $io, 'avanzu:admin:initialize', $arguments);
|
||||
$this->installAssets($output, $io, 'assets:install', $arguments);
|
||||
$this->installAssets($output, $io, 'avanzu:admin:fetch-vendor', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param OutputInterface $output
|
||||
* @param SymfonyStyle $io
|
||||
* @param string $cmdName
|
||||
* @param array $args
|
||||
* @return bool
|
||||
*/
|
||||
protected function installAssets(OutputInterface $output, SymfonyStyle $io, $cmdName, $args = [])
|
||||
{
|
||||
$command = $this->getApplication()->find($cmdName);
|
||||
try {
|
||||
$command = $this->getApplication()->find('doctrine:database:create');
|
||||
$command->run(new ArrayInput([]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to create database: ' . $ex->getMessage());
|
||||
return 1;
|
||||
}
|
||||
|
||||
try {
|
||||
$returnCode = $command->run(new ArrayInput($args), $output);
|
||||
$command = $this->getApplication()->find('doctrine:schema:create');
|
||||
$command->run(new ArrayInput([]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to install assets via "'.$cmdName.'": ' . $ex->getMessage());
|
||||
return false;
|
||||
$io->error('Failed to create database schema: ' . $ex->getMessage());
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ($returnCode != 0) {
|
||||
$io->error('Failed to install assets via "'.$cmdName.'"');
|
||||
return false;
|
||||
try {
|
||||
$command = $this->getApplication()->find('avanzu:admin:initialize');
|
||||
$command->run(new ArrayInput($arguments), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to initialize avanzu theme: ' . $ex->getMessage());
|
||||
return 3;
|
||||
}
|
||||
try {
|
||||
$command = $this->getApplication()->find('assets:install');
|
||||
$command->run(new ArrayInput($arguments), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to install assets: ' . $ex->getMessage());
|
||||
return 4;
|
||||
}
|
||||
try {
|
||||
$command = $this->getApplication()->find('avanzu:admin:fetch-vendor');
|
||||
$command->run(new ArrayInput([]), $output);
|
||||
} catch (\Exception $ex) {
|
||||
$io->error('Failed to fetch vendors for avanzu theme: ' . $ex->getMessage());
|
||||
return 5;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user