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 Alchemy\Phrasea\Model\Entities\ApiApplication;
|
||||||
use Silex\Application;
|
use Silex\Application;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
use Symfony\Component\Process\Process;
|
||||||
|
|
||||||
class PhraseaInstallSubscriber implements EventSubscriberInterface
|
class PhraseaInstallSubscriber implements EventSubscriberInterface
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,7 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface
|
|||||||
{
|
{
|
||||||
$this->createNavigatorApplication();
|
$this->createNavigatorApplication();
|
||||||
$this->createOfficePluginApplication();
|
$this->createOfficePluginApplication();
|
||||||
|
$this->generateProxies();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createNavigatorApplication()
|
private function createNavigatorApplication()
|
||||||
@@ -74,4 +76,11 @@ class PhraseaInstallSubscriber implements EventSubscriberInterface
|
|||||||
|
|
||||||
$this->app['manipulator.api-application']->update($application);
|
$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;
|
namespace Alchemy\Phrasea\Helper;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Connection;
|
||||||
|
|
||||||
class DatabaseHelper extends Helper
|
class DatabaseHelper extends Helper
|
||||||
{
|
{
|
||||||
public function checkConnection()
|
public function checkConnection()
|
||||||
@@ -21,66 +23,46 @@ class DatabaseHelper extends Helper
|
|||||||
$password = $this->request->query->get('password');
|
$password = $this->request->query->get('password');
|
||||||
$db_name = $this->request->query->get('db_name');
|
$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 {
|
/** @var Connection $connection */
|
||||||
$connection = $this->app['dbal.provider']([
|
$connection = $this->app['dbal.provider']([
|
||||||
'host' => $hostname,
|
'host' => $hostname,
|
||||||
'port' => $port,
|
'port' => $port,
|
||||||
'user' => $user,
|
'user' => $user,
|
||||||
'password' => $password
|
'password' => $password,
|
||||||
]);
|
'dbname' => $db_name,
|
||||||
$connection->connect();
|
]);
|
||||||
$connection_ok = true;
|
|
||||||
$connection->close();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
if (false !== $dbOK = $connection->isConnected()) {
|
||||||
unset($connection);
|
$sql = "SHOW TABLE STATUS";
|
||||||
|
$stmt = $connection->prepare($sql);
|
||||||
|
$stmt->execute();
|
||||||
|
|
||||||
if (null !== $db_name && $connection_ok) {
|
$empty = $stmt->rowCount() === 0;
|
||||||
try {
|
|
||||||
$connection = $this->app['dbal.provider']([
|
|
||||||
'host' => $hostname,
|
|
||||||
'port' => $port,
|
|
||||||
'user' => $user,
|
|
||||||
'password' => $password,
|
|
||||||
'dbname' => $db_name,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$db_ok = true;
|
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$sql = "SHOW TABLE STATUS";
|
foreach ($rs as $row) {
|
||||||
$stmt = $connection->prepare($sql);
|
if ($row["Name"] === 'sitepreff') {
|
||||||
$stmt->execute();
|
$is_appbox = true;
|
||||||
|
}
|
||||||
$empty = $stmt->rowCount() === 0;
|
if ($row["Name"] === 'pref') {
|
||||||
|
$is_databox = true;
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$connection->close();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
$connection->close();
|
||||||
unset($connection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unset($connection);
|
||||||
|
|
||||||
$this->app['connection.pool.manager']->closeAll();
|
$this->app['connection.pool.manager']->closeAll();
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'connection' => $connection_ok,
|
'connection' => $dbOK,
|
||||||
'innodb' => true,
|
'innodb' => true,
|
||||||
'database' => $db_ok,
|
'database' => $dbOK,
|
||||||
'is_empty' => $empty,
|
'is_empty' => $empty,
|
||||||
'is_appbox' => $is_appbox,
|
'is_appbox' => $is_appbox,
|
||||||
'is_databox' => $is_databox
|
'is_databox' => $is_databox
|
||||||
|
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"directory": "www/assets",
|
|
||||||
"interactive": false
|
|
||||||
}
|
|
@@ -145,16 +145,12 @@ then
|
|||||||
#copy configuration template
|
#copy configuration template
|
||||||
mv /var/www/phraseanet/lib/conf.d/configuration.yml /var/www/phraseanet/lib/conf.d/configuration.yml.bkp
|
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
|
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
|
cd /var/www/phraseanet
|
||||||
sudo -u vagrant composer install -n --prefer-source --dev
|
sudo -u vagrant composer install -n --prefer-source --dev
|
||||||
sudo -u vagrant npm install
|
sudo -u vagrant npm install
|
||||||
sudo -u vagrant grunt install-assets
|
sudo -u vagrant grunt install-assets
|
||||||
sudo -u vagrant bin/developer assets:compile-less
|
sudo -u vagrant bin/developer assets:compile-less
|
||||||
sudo -u vagrant rm -f /var/www/phraseanet/lib/conf.d/configuration.yml
|
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
|
mv /var/www/phraseanet/lib/conf.d/configuration.yml.bkp /var/www/phraseanet/lib/conf.d/configuration.yml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -167,5 +163,4 @@ sudo service nginx restart
|
|||||||
sudo service iptables-persistent stop
|
sudo service iptables-persistent stop
|
||||||
|
|
||||||
# reload bash
|
# reload bash
|
||||||
source ~/.bashrc
|
source ~/.bashrc
|
||||||
|
|
@@ -654,7 +654,7 @@
|
|||||||
<table class="main_content_table">
|
<table class="main_content_table">
|
||||||
<tr>
|
<tr>
|
||||||
<td><label>{{ 'Repertoire de stockage des fichiers' | trans }}</label></td>
|
<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>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
Reference in New Issue
Block a user