diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php index b8de9d1b5e..b7d7e033b7 100644 --- a/lib/classes/module/console/systemUpgrade.class.php +++ b/lib/classes/module/console/systemUpgrade.class.php @@ -1,4 +1,5 @@ writeln('This version of Phraseanet requires a config/config.inc'); + $output->writeln('Would you like it to be created based on your settings ?'); + + $dialog = $this->getHelperSet()->get('dialog'); + do + { + $continue = mb_strtolower($dialog->ask($output, '' . _('Create automatically') . ' (Y/n)', 'y')); + } + while (!in_array($continue, array('y', 'n'))); + + if ($continue == 'y') { - $output->writeln('This version of Phraseanet requires a config/config.inc'); - $output->writeln('Would you like it to be created based on your settings ?'); - - $dialog = $this->getHelperSet()->get('dialog'); - do - { - $continue = mb_strtolower($dialog->ask($output, '' . _('Create automatically') . ' (Y/n)', 'y')); - } - while (!in_array($continue, array('y', 'n'))); - - if ($continue == 'y') - { - require __DIR__ . "/../../../../config/_GV.php"; + $file = __DIR__ . "/../../config/config.sample.yml"; + $file1 = __DIR__ . "/../../config/config.yml"; - $datas = 'get_credentials(); + + $handler = new \Alchemy\Phrasea\Core\Configuration\Handler( + new \Alchemy\Phrasea\Core\Configuration\Application(), + new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml() + ); + $configuration = new \Alchemy\Phrasea\Core\Configuration($handler); + + $connexionINI = array(); + + foreach ($credentials as $key => $value) + { + $key = $key == 'hostname' ? 'host' : $key; + $connexionINI[$key] = (string) $value; + } + + $configuration->setAllDatabaseConnexion($connexionINI); + } + else + { + throw new RuntimeException('Phraseanet is not set up'); } - } require_once __DIR__ . '/../../../../lib/bootstrap.php';