mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
PHRAS-3772 bin/setup system:config add option (#4164)
* add option no compile -s for bin/setup system:config * check db connection on bin/console * add -s on migration script
This commit is contained in:
@@ -91,6 +91,10 @@ if (!$cli['phraseanet.configuration-tester']->isInstalled()) {
|
||||
throw new \RuntimeException('Phraseanet is not installed, use setup command instead');
|
||||
}
|
||||
|
||||
if (!$cli['phraseanet.configuration-tester']->isConnectedToDBHost()) {
|
||||
throw new \RuntimeException('Phraseanet can not connected to the provided DB, use setup command to config!');
|
||||
}
|
||||
|
||||
if (!$cli['phraseanet.configuration-tester']->isUpToDate()) {
|
||||
throw new \RuntimeException('Phraseanet is not up-to-date, use setup command instead');
|
||||
}
|
||||
|
@@ -17,6 +17,9 @@ Scripts can be play in a running FPM container with app users
|
||||
Before execution of they script keep a copie your existing source and destination "configuration.yml" files
|
||||
and place the configuration file need to be migrate in place of the current "configuration.yml" file
|
||||
|
||||
After execution of all script you need to `rm config/configuration-compiled.yml`
|
||||
and compile-configuration `bin/setup system:config compile`
|
||||
|
||||
### Datastore_conf
|
||||
|
||||
Update configuration.yml in accordance of containers env value for :
|
||||
|
@@ -6,10 +6,10 @@ cd "/var/alchemy/Phraseanet"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Applying infrastructure stack setup to Phraseanet Database connexion"
|
||||
|
||||
bin/setup system:config set main.database.host $PHRASEANET_DB_HOST
|
||||
bin/setup system:config set main.database.port $PHRASEANET_DB_PORT
|
||||
bin/setup system:config set main.database.user $PHRASEANET_DB_USER
|
||||
bin/setup system:config set main.database.password $PHRASEANET_DB_PASSWORD
|
||||
bin/setup system:config -s set main.database.host $PHRASEANET_DB_HOST
|
||||
bin/setup system:config -s set main.database.port $PHRASEANET_DB_PORT
|
||||
bin/setup system:config -s set main.database.user $PHRASEANET_DB_USER
|
||||
bin/setup system:config -s set main.database.password $PHRASEANET_DB_PASSWORD
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "setup of Phraseanet Database connexion applied"
|
||||
|
||||
@@ -19,15 +19,15 @@ cd "/var/alchemy/Phraseanet"
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phraseanet Elastisearch"
|
||||
|
||||
if [ -z "$PHRASEANET_ELASTICSEARCH_HOST" ]; then
|
||||
/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.host elasticsearch
|
||||
/var/alchemy/Phraseanet/bin/setup system:config -s set main.search-engine.options.host elasticsearch
|
||||
else
|
||||
/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.host $PHRASEANET_ELASTICSEARCH_HOST
|
||||
/var/alchemy/Phraseanet/bin/setup system:config -s set main.search-engine.options.host $PHRASEANET_ELASTICSEARCH_HOST
|
||||
fi
|
||||
|
||||
if [ -z "$PHRASEANET_ELASTICSEARCH_PORT" ]; then
|
||||
/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.port 9200
|
||||
/var/alchemy/Phraseanet/bin/setup system:config -s set main.search-engine.options.port 9200
|
||||
else
|
||||
/var/alchemy/Phraseanet/bin/setup system:config set main.search-engine.options.port $PHRASEANET_ELASTICSEARCH_PORT
|
||||
/var/alchemy/Phraseanet/bin/setup system:config -s set main.search-engine.options.port $PHRASEANET_ELASTICSEARCH_PORT
|
||||
fi
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "setup of Phraseanet elasticsearch applied"
|
||||
@@ -39,10 +39,10 @@ echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phra
|
||||
## Phraseanet application cache setting
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Applying infrastructure stack setup to Phraseanet application cache"
|
||||
|
||||
bin/setup system:config set main.cache.options.host $PHRASEANET_CACHE_HOST
|
||||
bin/setup system:config set main.cache.options.port $PHRASEANET_CACHE_PORT
|
||||
bin/setup system:config set main.cache.options.namespace $PHRASEANET_HOSTNAME
|
||||
bin/setup system:config set main.cache.type $PHRASEANET_CACHE_TYPE
|
||||
bin/setup system:config -s set main.cache.options.host $PHRASEANET_CACHE_HOST
|
||||
bin/setup system:config -s set main.cache.options.port $PHRASEANET_CACHE_PORT
|
||||
bin/setup system:config -s set main.cache.options.namespace $PHRASEANET_HOSTNAME
|
||||
bin/setup system:config -s set main.cache.type $PHRASEANET_CACHE_TYPE
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "setup of Phraseanet application cache applied"
|
||||
|
||||
@@ -50,8 +50,8 @@ echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phra
|
||||
## Phraseanet application session setting
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Applying infrastructure stack setup to Phraseanet session cache"
|
||||
|
||||
bin/setup system:config set main.session.type "native"
|
||||
bin/setup system:config set main.session.ttl "86400"
|
||||
bin/setup system:config -s set main.session.type "native"
|
||||
bin/setup system:config -s set main.session.ttl "86400"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "setup of Phraseanet session cache applied"
|
||||
|
||||
@@ -60,19 +60,21 @@ echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phra
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phraseanet setting RABBITMQ"
|
||||
|
||||
bin/setup system:config set workers.queue.worker-queue.host $PHRASEANET_RABBITMQ_HOST
|
||||
bin/setup system:config set workers.queue.worker-queue.port $PHRASEANET_RABBITMQ_PORT
|
||||
bin/setup system:config set workers.queue.worker-queue.vhost $PHRASEANET_RABBITMQ_VHOST
|
||||
bin/setup system:config set workers.queue.worker-queue.ssl $PHRASEANET_RABBITMQ_SSL
|
||||
bin/setup system:config set workers.queue.worker-queue.heartbeat $PHRASEANET_RABBITMQ_HEARTBEAT
|
||||
bin/setup system:config set workers.queue.worker-queue.user $PHRASEANET_RABBITMQ_USER
|
||||
bin/setup system:config set workers.queue.worker-queue.password $PHRASEANET_RABBITMQ_PASSWORD
|
||||
bin/setup system:config -s set workers.queue.worker-queue.host $PHRASEANET_RABBITMQ_HOST
|
||||
bin/setup system:config -s set workers.queue.worker-queue.port $PHRASEANET_RABBITMQ_PORT
|
||||
bin/setup system:config -s set workers.queue.worker-queue.vhost $PHRASEANET_RABBITMQ_VHOST
|
||||
bin/setup system:config -s set workers.queue.worker-queue.ssl $PHRASEANET_RABBITMQ_SSL
|
||||
bin/setup system:config -s set workers.queue.worker-queue.heartbeat $PHRASEANET_RABBITMQ_HEARTBEAT
|
||||
bin/setup system:config -s set workers.queue.worker-queue.user $PHRASEANET_RABBITMQ_USER
|
||||
bin/setup system:config -s set workers.queue.worker-queue.password $PHRASEANET_RABBITMQ_PASSWORD
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - setup of Phraseanet setting RABBITMQ applied"
|
||||
|
||||
cd -
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - End of datastore migration - Check databases in \"sbas\" table in Application Box"
|
||||
echo "The configuration file is not compile"
|
||||
echo "to compile use : bin/setup system:config compile"
|
||||
|
||||
|
||||
|
||||
|
@@ -4,14 +4,14 @@ cd "/var/alchemy/Phraseanet"
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Applying infrastructure stack setup to Phraseanet SMTP"
|
||||
|
||||
if [[ $PHRASEANET_SMTP_ENABLED && $PHRASEANET_SMTP_ENABLED = true ]]; then
|
||||
bin/setup system:config set registry.email.smtp-enabled $PHRASEANET_SMTP_ENABLED
|
||||
bin/setup system:config set registry.email.smtp-auth-enabled $PHRASEANET_SMTP_AUTH_ENABLED
|
||||
bin/setup system:config set registry.email.smtp-secure-mode $PHRASEANET_SMTP_SECURE_MODE
|
||||
bin/setup system:config set registry.email.smtp-host $PHRASEANET_SMTP_HOST
|
||||
bin/setup system:config set registry.email.smtp-port $PHRASEANET_SMTP_PORT
|
||||
bin/setup system:config set registry.email.smtp-user $PHRASEANET_SMTP_USER
|
||||
bin/setup system:config set registry.email.smtp-password $PHRASEANET_SMTP_PASSWORD
|
||||
bin/setup system:config set registry.email.emitter-email $PHRASEANET_EMITTER_EMAIL
|
||||
bin/setup system:config -s set registry.email.smtp-enabled $PHRASEANET_SMTP_ENABLED
|
||||
bin/setup system:config -s set registry.email.smtp-auth-enabled $PHRASEANET_SMTP_AUTH_ENABLED
|
||||
bin/setup system:config -s set registry.email.smtp-secure-mode $PHRASEANET_SMTP_SECURE_MODE
|
||||
bin/setup system:config -s set registry.email.smtp-host $PHRASEANET_SMTP_HOST
|
||||
bin/setup system:config -s set registry.email.smtp-port $PHRASEANET_SMTP_PORT
|
||||
bin/setup system:config -s set registry.email.smtp-user $PHRASEANET_SMTP_USER
|
||||
bin/setup system:config -s set registry.email.smtp-password $PHRASEANET_SMTP_PASSWORD
|
||||
bin/setup system:config -s set registry.email.emitter-email $PHRASEANET_EMITTER_EMAIL
|
||||
fi
|
||||
|
||||
cd -
|
||||
|
@@ -10,10 +10,10 @@ if [[ -n $PHRASEANET_TRUSTED_PROXIES ]]; then
|
||||
do
|
||||
counter=$(( counter+1 ))
|
||||
if [[ $counter -eq 1 ]] ; then
|
||||
bin/setup system:config set trusted-proxies $i
|
||||
bin/setup system:config add trusted-proxies $i
|
||||
bin/setup system:config -s set trusted-proxies $i
|
||||
bin/setup system:config -s add trusted-proxies $i
|
||||
else
|
||||
bin/setup system:config add trusted-proxies $i
|
||||
bin/setup system:config -s add trusted-proxies $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
@@ -29,10 +29,10 @@ if [[ -n $PHRASEANET_DEBUG_ALLOWED_IP ]]; then
|
||||
do
|
||||
counter=$(( counter+1 ))
|
||||
if [[ $counter -eq 1 ]] ; then
|
||||
bin/setup system:config set debugger.allowed-ips $i
|
||||
bin/setup system:config add debugger.allowed-ips $i
|
||||
bin/setup system:config -s set debugger.allowed-ips $i
|
||||
bin/setup system:config -s add debugger.allowed-ips $i
|
||||
else
|
||||
bin/setup system:config add debugger.allowed-ips $i
|
||||
bin/setup system:config -s add debugger.allowed-ips $i
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
@@ -4,28 +4,28 @@ cd "/var/alchemy/Phraseanet"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "update binaries path in accordance of docker stack"
|
||||
|
||||
bin/setup system:config set main.binaries.php_binary "/usr/local/bin/php"
|
||||
bin/setup system:config set main.binaries.ghostscript_binary "/usr/bin/gs"
|
||||
bin/setup system:config set main.binaries.swf_extract_binary "/usr/bin/swfextract"
|
||||
bin/setup system:config set main.binaries.pdf2swf_binary null
|
||||
bin/setup system:config set main.binaries.swf_render_binary "/usr/bin/swfrender"
|
||||
bin/setup system:config set main.binaries.unoconv_binary "/usr/bin/unoconv"
|
||||
bin/setup system:config set main.binaries.ffmpeg_binary "/usr/local/bin/ffmpeg"
|
||||
bin/setup system:config set main.binaries.ffprobe_binary "/usr/local/bin/ffprobe"
|
||||
bin/setup system:config set main.binaries.mp4box_binary "/usr/bin/MP4Box"
|
||||
bin/setup system:config set main.binaries.pdftotext_binary "/usr/bin/pdftotext"
|
||||
bin/setup system:config -s set main.binaries.php_binary "/usr/local/bin/php"
|
||||
bin/setup system:config -s set main.binaries.ghostscript_binary "/usr/bin/gs"
|
||||
bin/setup system:config -s set main.binaries.swf_extract_binary "/usr/bin/swfextract"
|
||||
bin/setup system:config -s set main.binaries.pdf2swf_binary null
|
||||
bin/setup system:config -s set main.binaries.swf_render_binary "/usr/bin/swfrender"
|
||||
bin/setup system:config -s set main.binaries.unoconv_binary "/usr/bin/unoconv"
|
||||
bin/setup system:config -s set main.binaries.ffmpeg_binary "/usr/local/bin/ffmpeg"
|
||||
bin/setup system:config -s set main.binaries.ffprobe_binary "/usr/local/bin/ffprobe"
|
||||
bin/setup system:config -s set main.binaries.mp4box_binary "/usr/bin/MP4Box"
|
||||
bin/setup system:config -s set main.binaries.pdftotext_binary "/usr/bin/pdftotext"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "binaries path applied"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "update storage path in accordance of docker stack"
|
||||
|
||||
bin/setup system:config set main.storage.subdefs "/var/alchemy/Phraseanet/datas"
|
||||
bin/setup system:config set main.storage.cache "/var/alchemy/Phraseanet/cache"
|
||||
bin/setup system:config set main.storage.log "/var/alchemy/Phraseanet/logs"
|
||||
bin/setup system:config set main.storage.download "/var/alchemy/Phraseanet/datas/download"
|
||||
bin/setup system:config set main.storage.lazaret "/var/alchemy/Phraseanet/datas/lazaret"
|
||||
bin/setup system:config set main.storage.caption "/var/alchemy/Phraseanet/tmp/caption"
|
||||
bin/setup system:config set main.storage.worker_tmp_files "/var/alchemy/Phraseanet/tmp/worker"
|
||||
bin/setup system:config -s set main.storage.subdefs "/var/alchemy/Phraseanet/datas"
|
||||
bin/setup system:config -s set main.storage.cache "/var/alchemy/Phraseanet/cache"
|
||||
bin/setup system:config -s set main.storage.log "/var/alchemy/Phraseanet/logs"
|
||||
bin/setup system:config -s set main.storage.download "/var/alchemy/Phraseanet/datas/download"
|
||||
bin/setup system:config -s set main.storage.lazaret "/var/alchemy/Phraseanet/datas/lazaret"
|
||||
bin/setup system:config -s set main.storage.caption "/var/alchemy/Phraseanet/tmp/caption"
|
||||
bin/setup system:config -s set main.storage.worker_tmp_files "/var/alchemy/Phraseanet/tmp/worker"
|
||||
|
||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "storage path path applied"
|
||||
|
||||
|
@@ -6,11 +6,13 @@ use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Core\Configuration\Configuration;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class ConfigurationEditor extends Command
|
||||
{
|
||||
private $noCompile = false;
|
||||
|
||||
public function __construct($name)
|
||||
{
|
||||
@@ -22,12 +24,12 @@ class ConfigurationEditor extends Command
|
||||
$this->addArgument(
|
||||
'operation',
|
||||
InputArgument::REQUIRED,
|
||||
'The operation to execute (get, set, or add)'
|
||||
'The operation to execute (get, set, add, compile)'
|
||||
);
|
||||
|
||||
$this->addArgument(
|
||||
'parameter',
|
||||
InputArgument::REQUIRED,
|
||||
InputArgument::OPTIONAL,
|
||||
'The name of the configuration parameter to get or set'
|
||||
);
|
||||
|
||||
@@ -36,15 +38,27 @@ class ConfigurationEditor extends Command
|
||||
InputArgument::OPTIONAL,
|
||||
'The value to set when operation is "set" or "add", in YAML syntax'
|
||||
);
|
||||
|
||||
$this->addOption('no-compile', "s", InputOption::VALUE_NONE, 'Do not compile the config after save in yml file');
|
||||
}
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$command = $input->getArgument('operation');
|
||||
$parameter = $input->getArgument('parameter');
|
||||
$this->noCompile = $input->getOption('no-compile');
|
||||
|
||||
$parameterNodes = explode('.', $parameter);
|
||||
|
||||
if ($command == 'compile') {
|
||||
$this->compileConfiguration($output);
|
||||
} else {
|
||||
if (empty($parameter)) {
|
||||
$output->writeln("<error>Missing 'parameter' argument</error>");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ($command == 'get') {
|
||||
$this->readConfigurationValue($output, $parameter, $parameterNodes);
|
||||
}
|
||||
@@ -53,6 +67,9 @@ class ConfigurationEditor extends Command
|
||||
}
|
||||
elseif ($command == 'add') {
|
||||
$this->appendConfigurationValue($output, $parameter, $parameterNodes, $input->getArgument('value'));
|
||||
} else {
|
||||
$output->writeln("<error>Command not found</error>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +78,7 @@ class ConfigurationEditor extends Command
|
||||
$app = $this->getContainer();
|
||||
/** @var Configuration $config */
|
||||
$config = $app['configuration.store'];
|
||||
$config->setNoCompile($this->noCompile);
|
||||
$values = $config->getConfig();
|
||||
$current = $values;
|
||||
|
||||
@@ -78,6 +96,7 @@ class ConfigurationEditor extends Command
|
||||
$app = $this->getContainer();
|
||||
/** @var Configuration $configurationStore */
|
||||
$configurationStore = $app['configuration.store'];
|
||||
$configurationStore->setNoCompile($this->noCompile);
|
||||
$lastParameter = end($parameterNodes);
|
||||
|
||||
$configurationRoot = $configurationStore->getConfig();
|
||||
@@ -100,7 +119,9 @@ class ConfigurationEditor extends Command
|
||||
}
|
||||
|
||||
$configurationStore->setConfig($configurationRoot);
|
||||
if (!$this->noCompile) {
|
||||
$configurationStore->compileAndWrite();
|
||||
}
|
||||
|
||||
$output->writeln('<comment>Reading updated configuration value</comment>');
|
||||
|
||||
@@ -112,6 +133,7 @@ class ConfigurationEditor extends Command
|
||||
$app = $this->getContainer();
|
||||
/** @var Configuration $configurationStore */
|
||||
$configurationStore = $app['configuration.store'];
|
||||
$configurationStore->setNoCompile($this->noCompile);
|
||||
$lastParameter = end($parameterNodes);
|
||||
|
||||
$configurationRoot = $configurationStore->getConfig();
|
||||
@@ -144,7 +166,9 @@ class ConfigurationEditor extends Command
|
||||
}
|
||||
|
||||
$configurationStore->setConfig($configurationRoot);
|
||||
if (!$this->noCompile) {
|
||||
$configurationStore->compileAndWrite();
|
||||
}
|
||||
|
||||
$output->writeln('<comment>Reading updated configuration value</comment>');
|
||||
|
||||
@@ -176,4 +200,10 @@ class ConfigurationEditor extends Command
|
||||
$output->write(PHP_EOL);
|
||||
}
|
||||
}
|
||||
|
||||
private function compileConfiguration(OutputInterface $output)
|
||||
{
|
||||
$this->container['configuration.store']->compileAndWrite();
|
||||
$output->writeln('<comment>Configuration compiled!</comment>');
|
||||
}
|
||||
}
|
||||
|
@@ -26,6 +26,8 @@ class Configuration implements ConfigurationInterface
|
||||
private $compiled;
|
||||
private $autoReload;
|
||||
|
||||
private $noCompile = false;
|
||||
|
||||
/**
|
||||
* @param Yaml $yaml The Yaml Parser
|
||||
* @param Compiler $compiler The PHP Compiler
|
||||
@@ -117,11 +119,25 @@ class Configuration implements ConfigurationInterface
|
||||
return $newConfig;
|
||||
}
|
||||
|
||||
public function setNoCompile(bool $noCompile)
|
||||
{
|
||||
$this->noCompile = !!$noCompile;
|
||||
}
|
||||
|
||||
public function getNoCompile()
|
||||
{
|
||||
return $this->noCompile;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getConfig()
|
||||
{
|
||||
if ($this->noCompile) {
|
||||
return $this->parser->parse($this->loadFile($this->config));
|
||||
}
|
||||
|
||||
if (null !== $this->cache) {
|
||||
return $this->cache;
|
||||
}
|
||||
@@ -145,7 +161,9 @@ class Configuration implements ConfigurationInterface
|
||||
{
|
||||
$this->cache = $config;
|
||||
$this->dumpFile($this->config, $this->parser->dump($config, 7), 0660);
|
||||
if (!$this->noCompile) {
|
||||
$this->writeCacheConfig($this->compiler->compile($config));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
@@ -13,6 +13,13 @@ namespace Alchemy\Phrasea\Core\Configuration;
|
||||
|
||||
interface ConfigurationInterface extends \ArrayAccess
|
||||
{
|
||||
/**
|
||||
* Do not compile, just save the config
|
||||
*
|
||||
* @param bool $noCompile
|
||||
*/
|
||||
public function setNoCompile(bool $noCompile);
|
||||
|
||||
/**
|
||||
* Initialize configuration file in setup.
|
||||
*
|
||||
|
@@ -155,6 +155,10 @@ class HostConfiguration implements ConfigurationInterface
|
||||
throw new RuntimeException('Configuration is not set up.');
|
||||
}
|
||||
|
||||
if ($this->configuration->getNoCompile()) {
|
||||
return $this->configuration->getConfig();
|
||||
}
|
||||
|
||||
return $this->cache;
|
||||
}
|
||||
|
||||
@@ -180,6 +184,11 @@ class HostConfiguration implements ConfigurationInterface
|
||||
$this->setHost($this->host);
|
||||
}
|
||||
|
||||
public function setNoCompile(bool $noCompile)
|
||||
{
|
||||
$this->configuration->setNoCompile($noCompile);
|
||||
}
|
||||
|
||||
private function match($host, $hostname)
|
||||
{
|
||||
return $this->removeHostPrefix($host) === $this->removeHostPrefix($hostname);
|
||||
|
@@ -90,6 +90,7 @@ class ORMServiceProvider implements ServiceProviderInterface
|
||||
return array();
|
||||
}
|
||||
|
||||
try {
|
||||
/** @var Connection $connection */
|
||||
$connection = $app['dbal.provider']($app['db.appbox.info']);
|
||||
|
||||
@@ -98,6 +99,9 @@ class ORMServiceProvider implements ServiceProviderInterface
|
||||
. " FROM sbas";
|
||||
|
||||
return $connection->fetchAll($sql);
|
||||
} catch (\Exception $e) {
|
||||
return [];
|
||||
}
|
||||
});
|
||||
|
||||
// Return unique key for fixture database
|
||||
|
@@ -7,7 +7,7 @@ use Alchemy\Phrasea\Core\Version;
|
||||
interface VersionRepository
|
||||
{
|
||||
|
||||
const DEFAULT_VERSION = '0.0.0.0';
|
||||
const DEFAULT_VERSION = '0.0.0';
|
||||
|
||||
/**
|
||||
* @return string
|
||||
|
@@ -25,6 +25,7 @@ use Alchemy\Phrasea\Setup\Probe\PhpProbe;
|
||||
use Alchemy\Phrasea\Setup\Probe\SearchEngineProbe;
|
||||
use Alchemy\Phrasea\Setup\Probe\SubdefsPathsProbe;
|
||||
use Alchemy\Phrasea\Setup\Probe\SystemProbe;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use vierbergenlars\SemVer\version;
|
||||
|
||||
class ConfigurationTester
|
||||
@@ -130,6 +131,22 @@ class ConfigurationTester
|
||||
return (Boolean) $this->getMigrations();
|
||||
}
|
||||
|
||||
public function isConnectedToDBHost()
|
||||
{
|
||||
$connectionConfig = $this->app['conf']->get(['main', 'database']);
|
||||
/** @var Connection $connection */
|
||||
$connection = $this->app['db.provider']($connectionConfig);
|
||||
|
||||
try {
|
||||
$connection->connect();
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function getMigrations()
|
||||
{
|
||||
$migrations = [];
|
||||
|
@@ -207,7 +207,11 @@ abstract class base implements cache_cacheableInterface
|
||||
public function get_version()
|
||||
{
|
||||
if (! $this->version) {
|
||||
try {
|
||||
$this->version = $this->versionRepository->getVersion();
|
||||
} catch(\Throwable $e) {
|
||||
return PhraseaVersion\VersionRepository::DEFAULT_VERSION;
|
||||
}
|
||||
}
|
||||
|
||||
return $this->version;
|
||||
|
@@ -67,4 +67,9 @@ class MockArrayConf implements ConfigurationInterface
|
||||
{
|
||||
throw new \Exception('not implemented');
|
||||
}
|
||||
|
||||
public function setNoCompile(bool $noCompile)
|
||||
{
|
||||
throw new \Exception('not implemented');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user