mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-25 18:45:27 -06:00
Added step to download GeoLite2 db during installation
This commit is contained in:
parent
bf56e6adaf
commit
1aa78f766a
@ -10,7 +10,6 @@ use Shlinkio\Shlink\Installer\Config\Plugin;
|
|||||||
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
|
||||||
use Shlinkio\Shlink\Installer\Util\AskUtilsTrait;
|
use Shlinkio\Shlink\Installer\Util\AskUtilsTrait;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Exception\InvalidArgumentException;
|
|
||||||
use Symfony\Component\Console\Exception\LogicException;
|
use Symfony\Component\Console\Exception\LogicException;
|
||||||
use Symfony\Component\Console\Exception\RuntimeException;
|
use Symfony\Component\Console\Exception\RuntimeException;
|
||||||
use Symfony\Component\Console\Helper\ProcessHelper;
|
use Symfony\Component\Console\Helper\ProcessHelper;
|
||||||
@ -149,7 +148,7 @@ class InstallCommand extends Command
|
|||||||
// If current command is not update, generate database
|
// If current command is not update, generate database
|
||||||
if (! $this->isUpdate) {
|
if (! $this->isUpdate) {
|
||||||
$this->io->write('Initializing database...');
|
$this->io->write('Initializing database...');
|
||||||
if (! $this->runPhpCommand(
|
if (! $this->execPhp(
|
||||||
'vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:create',
|
'vendor/doctrine/orm/bin/doctrine.php orm:schema-tool:create',
|
||||||
'Error generating database.',
|
'Error generating database.',
|
||||||
$output
|
$output
|
||||||
@ -160,7 +159,7 @@ class InstallCommand extends Command
|
|||||||
|
|
||||||
// Run database migrations
|
// Run database migrations
|
||||||
$this->io->write('Updating database...');
|
$this->io->write('Updating database...');
|
||||||
if (! $this->runPhpCommand(
|
if (! $this->execPhp(
|
||||||
'vendor/doctrine/migrations/bin/doctrine-migrations.php migrations:migrate',
|
'vendor/doctrine/migrations/bin/doctrine-migrations.php migrations:migrate',
|
||||||
'Error updating database.',
|
'Error updating database.',
|
||||||
$output
|
$output
|
||||||
@ -170,7 +169,7 @@ class InstallCommand extends Command
|
|||||||
|
|
||||||
// Generate proxies
|
// Generate proxies
|
||||||
$this->io->write('Generating proxies...');
|
$this->io->write('Generating proxies...');
|
||||||
if (! $this->runPhpCommand(
|
if (! $this->execPhp(
|
||||||
'vendor/doctrine/orm/bin/doctrine.php orm:generate-proxies',
|
'vendor/doctrine/orm/bin/doctrine.php orm:generate-proxies',
|
||||||
'Error generating proxies.',
|
'Error generating proxies.',
|
||||||
$output
|
$output
|
||||||
@ -178,6 +177,12 @@ class InstallCommand extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Download GeoLite2 db filte
|
||||||
|
$this->io->write('Downloading GeoLite2 db...');
|
||||||
|
if (! $this->execPhp('bin/cli visit:update-db', 'Error downloading GeoLite2 db.', $output)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$this->io->success('Installation complete!');
|
$this->io->success('Installation complete!');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -226,15 +231,7 @@ class InstallCommand extends Command
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private function execPhp(string $command, string $errorMessage, OutputInterface $output): bool
|
||||||
* @param string $command
|
|
||||||
* @param string $errorMessage
|
|
||||||
* @param OutputInterface $output
|
|
||||||
* @return bool
|
|
||||||
* @throws LogicException
|
|
||||||
* @throws InvalidArgumentException
|
|
||||||
*/
|
|
||||||
private function runPhpCommand($command, $errorMessage, OutputInterface $output): bool
|
|
||||||
{
|
{
|
||||||
if ($this->processHelper === null) {
|
if ($this->processHelper === null) {
|
||||||
$this->processHelper = $this->getHelper('process');
|
$this->processHelper = $this->getHelper('process');
|
||||||
|
Loading…
Reference in New Issue
Block a user