diff --git a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaInstallSubscriber.php b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaInstallSubscriber.php index ae0f9b415a..91d7efaaac 100644 --- a/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaInstallSubscriber.php +++ b/lib/Alchemy/Phrasea/Core/Event/Subscriber/PhraseaInstallSubscriber.php @@ -16,6 +16,7 @@ use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Model\Entities\ApiApplication; use Silex\Application; use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\Process\Process; class PhraseaInstallSubscriber implements EventSubscriberInterface { @@ -37,6 +38,7 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface { $this->createNavigatorApplication(); $this->createOfficePluginApplication(); + $this->generateProxies(); } private function createNavigatorApplication() @@ -74,4 +76,11 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface $this->app['manipulator.api-application']->update($application); } + + private function generateProxies() + { + $process = new Process('php ' . $this->app['root.path']. '/bin/developer orm:generate:proxies'); + $process->setTimeout(300); + $process->run(); + } } diff --git a/lib/Alchemy/Phrasea/Helper/DatabaseHelper.php b/lib/Alchemy/Phrasea/Helper/DatabaseHelper.php index 49bc1207bb..2d39b5f0c7 100644 --- a/lib/Alchemy/Phrasea/Helper/DatabaseHelper.php +++ b/lib/Alchemy/Phrasea/Helper/DatabaseHelper.php @@ -11,6 +11,8 @@ namespace Alchemy\Phrasea\Helper; +use Doctrine\DBAL\Connection; + class DatabaseHelper extends Helper { public function checkConnection() @@ -21,66 +23,46 @@ class DatabaseHelper extends Helper $password = $this->request->query->get('password'); $db_name = $this->request->query->get('db_name'); - $connection_ok = $db_ok = $is_databox = $is_appbox = $empty = false; + $is_databox = $is_appbox = $empty = false; - try { - $connection = $this->app['dbal.provider']([ - 'host' => $hostname, - 'port' => $port, - 'user' => $user, - 'password' => $password - ]); - $connection->connect(); - $connection_ok = true; - $connection->close(); - } catch (\Exception $e) { + /** @var Connection $connection */ + $connection = $this->app['dbal.provider']([ + 'host' => $hostname, + 'port' => $port, + 'user' => $user, + 'password' => $password, + 'dbname' => $db_name, + ]); - } - unset($connection); + if (false !== $dbOK = $connection->isConnected()) { + $sql = "SHOW TABLE STATUS"; + $stmt = $connection->prepare($sql); + $stmt->execute(); - if (null !== $db_name && $connection_ok) { - try { - $connection = $this->app['dbal.provider']([ - 'host' => $hostname, - 'port' => $port, - 'user' => $user, - 'password' => $password, - 'dbname' => $db_name, - ]); + $empty = $stmt->rowCount() === 0; - $db_ok = true; + $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $stmt->closeCursor(); - $sql = "SHOW TABLE STATUS"; - $stmt = $connection->prepare($sql); - $stmt->execute(); - - $empty = $stmt->rowCount() === 0; - - $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); - $stmt->closeCursor(); - - foreach ($rs as $row) { - if ($row["Name"] === 'sitepreff') { - $is_appbox = true; - } - if ($row["Name"] === 'pref') { - $is_databox = true; - } + foreach ($rs as $row) { + if ($row["Name"] === 'sitepreff') { + $is_appbox = true; + } + if ($row["Name"] === 'pref') { + $is_databox = true; } - $connection->close(); - } catch (\Exception $e) { - } - - unset($connection); + $connection->close(); } + unset($connection); + $this->app['connection.pool.manager']->closeAll(); return [ - 'connection' => $connection_ok, + 'connection' => $dbOK, 'innodb' => true, - 'database' => $db_ok, + 'database' => $dbOK, 'is_empty' => $empty, 'is_appbox' => $is_appbox, 'is_databox' => $is_databox diff --git a/resources/vagrant/config/bower/.bowerrc b/resources/vagrant/config/bower/.bowerrc deleted file mode 100644 index f303864386..0000000000 --- a/resources/vagrant/config/bower/.bowerrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "directory": "www/assets", - "interactive": false -} diff --git a/resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup b/resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup index ff7db2474e..598dcb2c7d 100644 --- a/resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup +++ b/resources/vagrant/vms/phraseanet-php54-nginx/puphpet/files/exec-once/setup @@ -145,16 +145,12 @@ then #copy configuration template mv /var/www/phraseanet/lib/conf.d/configuration.yml /var/www/phraseanet/lib/conf.d/configuration.yml.bkp cp /vagrant/resources/vagrant/config/phraseanet/configuration.yml /var/www/phraseanet/lib/conf.d/configuration.yml - mv /var/www/phraseanet/.bowerrc /var/www/phraseanet/.bowerrc.bkp - cp /vagrant/resources/vagrant/config/bower/.bowerrc /var/www/phraseanet/.bowerrc cd /var/www/phraseanet sudo -u vagrant composer install -n --prefer-source --dev sudo -u vagrant npm install sudo -u vagrant grunt install-assets sudo -u vagrant bin/developer assets:compile-less sudo -u vagrant rm -f /var/www/phraseanet/lib/conf.d/configuration.yml - rm -f /var/www/phraseanet/.bowerrc - mv /www/phraseanet/.bowerrc.bkp /www/phraseanet/.bowerrc mv /var/www/phraseanet/lib/conf.d/configuration.yml.bkp /var/www/phraseanet/lib/conf.d/configuration.yml fi @@ -167,5 +163,4 @@ sudo service nginx restart sudo service iptables-persistent stop # reload bash -source ~/.bashrc - +source ~/.bashrc \ No newline at end of file diff --git a/templates/web/setup/step2.html.twig b/templates/web/setup/step2.html.twig index 35dcdd4896..a331ae4e09 100644 --- a/templates/web/setup/step2.html.twig +++ b/templates/web/setup/step2.html.twig @@ -654,7 +654,7 @@ - +