mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
Merge pull request #1261 from bburnichon/feature/install-fixes
Fixup installation process
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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
|
||||
|
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"directory": "www/assets",
|
||||
"interactive": false
|
||||
}
|
@@ -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
|
@@ -654,7 +654,7 @@
|
||||
<table class="main_content_table">
|
||||
<tr>
|
||||
<td><label>{{ 'Repertoire de stockage des fichiers' | trans }}</label></td>
|
||||
<td><input class="path_to_test test_writeable required" type="text" name="datapath_noweb" value="" /></td>
|
||||
<td><input class="path_to_test test_writeable required" type="text" name="datapath_noweb" value="{{ rootpath ~ '/datas' }}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user