mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
New installer
This commit is contained in:
@@ -65,6 +65,7 @@ use Alchemy\Phrasea\Controller\Root\Developers;
|
||||
use Alchemy\Phrasea\Controller\Root\Login;
|
||||
use Alchemy\Phrasea\Controller\Root\RSSFeeds;
|
||||
use Alchemy\Phrasea\Controller\Root\Session;
|
||||
use Alchemy\Phrasea\Controller\Setup as SetupController;
|
||||
use Alchemy\Phrasea\Controller\Thesaurus\Thesaurus;
|
||||
use Alchemy\Phrasea\Controller\Thesaurus\Xmlhttp as ThesaurusXMLHttp;
|
||||
use Alchemy\Phrasea\Controller\Utils\ConnectionTest;
|
||||
@@ -79,6 +80,7 @@ use Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\ConfigurationTesterServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\FtpServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\GeonamesServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\InstallerServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\NotificationDelivererServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\ORMServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\PhraseanetServiceProvider;
|
||||
@@ -217,6 +219,7 @@ class Application extends SilexApplication
|
||||
$this->register(new MP4BoxServiceProvider());
|
||||
$this->register(new NotificationDelivererServiceProvider());
|
||||
$this->register(new ORMServiceProvider());
|
||||
$this->register(new InstallerServiceProvider());
|
||||
$this->register(new PhraseanetServiceProvider());
|
||||
$this->register(new PhraseaVersionServiceProvider());
|
||||
$this->register(new PhraseaLocaleServiceProvider());
|
||||
@@ -593,6 +596,10 @@ class Application extends SilexApplication
|
||||
return new Response($buffer, 200, array('Content-Type' => 'text/plain'));
|
||||
})->bind('robots');
|
||||
|
||||
$this->mount('/setup/test', new PathFileTest());
|
||||
$this->mount('/setup/connection_test', new ConnectionTest());
|
||||
$this->mount('/setup', new SetupController());
|
||||
|
||||
$this->mount('/feeds/', new RSSFeeds());
|
||||
$this->mount('/account/', new Account());
|
||||
$this->mount('/login/', new Login());
|
||||
|
@@ -21,8 +21,14 @@ return call_user_func(function($environment = null) {
|
||||
|
||||
$app = new PhraseaApplication($environment);
|
||||
|
||||
$app->before(function () use ($app) {
|
||||
$app['firewall']->requireSetup();
|
||||
$app->before(function (Request $request) use ($app) {
|
||||
if (0 === strpos($request->getPathInfo(), '/setup')) {
|
||||
if (!$app['phraseanet.configuration-tester']->isBlank()) {
|
||||
return $app->redirect('/login/');
|
||||
}
|
||||
} else {
|
||||
$app['firewall']->requireSetup();
|
||||
}
|
||||
});
|
||||
|
||||
$app->before(function(Request $request) use ($app) {
|
||||
|
@@ -1,57 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Application;
|
||||
|
||||
use Alchemy\Phrasea\Controller\Setup\Installer;
|
||||
use Alchemy\Phrasea\Controller\Utils\ConnectionTest;
|
||||
use Alchemy\Phrasea\Controller\Utils\PathFileTest;
|
||||
use Silex\Application as SilexApplication;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
return call_user_func(function() {
|
||||
|
||||
$app = new SilexApplication();
|
||||
|
||||
$app['debug'] = true;
|
||||
|
||||
$app['twig'] = $app->share(function (SilexApplication $app) {
|
||||
$ld_path = array(__DIR__ . '/../../../../templates/web');
|
||||
$loader = new \Twig_Loader_Filesystem($ld_path);
|
||||
|
||||
$twig = new \Twig_Environment($loader);
|
||||
$twig->addExtension(new \Twig_Extensions_Extension_I18n());
|
||||
|
||||
return $twig;
|
||||
});
|
||||
|
||||
$app->get('/', function(SilexApplication $app) {
|
||||
if (!$app['phraseanet.configuration-tester']->isBlank()) {
|
||||
return $app->redirect('/login/');
|
||||
}
|
||||
|
||||
return $app->redirect('/setup/installer/');
|
||||
});
|
||||
|
||||
$app->mount('/installer/', new Installer());
|
||||
$app->mount('/test', new PathFileTest());
|
||||
$app->mount('/connection_test', new ConnectionTest());
|
||||
|
||||
$app->error(function($e) use ($app) {
|
||||
if ($e instanceof \Exception_Setup_PhraseaAlreadyInstalled) {
|
||||
return $app->redirect('/login/');
|
||||
}
|
||||
|
||||
return new Response('Internal Server Error', 500, array('X-Status-Code' => 500));
|
||||
});
|
||||
|
||||
return $app;
|
||||
});
|
@@ -12,12 +12,8 @@
|
||||
namespace Alchemy\Phrasea\Command\Setup;
|
||||
|
||||
use Alchemy\Phrasea\Command\Command;
|
||||
use Alchemy\Phrasea\Setup\Installer;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Process\ExecutableFinder;
|
||||
use Symfony\Component\Console\Helper\DialogHelper;
|
||||
use Alchemy\Phrasea\Setup\Requirements\BinariesRequirements;
|
||||
use Alchemy\Phrasea\Setup\Requirements\FilesystemRequirements;
|
||||
use Alchemy\Phrasea\Setup\Requirements\LocalesRequirements;
|
||||
|
@@ -9,51 +9,50 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Controller\Setup;
|
||||
namespace Alchemy\Phrasea\Controller;
|
||||
|
||||
use Silex\Application;
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Silex\ControllerProviderInterface;
|
||||
use Silex\Application as SilexApplication;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/**
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Installer implements ControllerProviderInterface
|
||||
{
|
||||
|
||||
public function connect(Application $app)
|
||||
class Setup implements ControllerProviderInterface
|
||||
{
|
||||
public function connect(SilexApplication $app)
|
||||
{
|
||||
$controllers = $app['controllers_factory'];
|
||||
|
||||
$controllers->get('/', $this->call('rootInstaller'));
|
||||
$controllers->get('/', function(Application $app) {
|
||||
return $app->redirect('/setup/installer/');
|
||||
});
|
||||
|
||||
$controllers->get('/step2/', $this->call('getInstallForm'));
|
||||
$controllers->get('/installer/', $this->call('rootInstaller'))
|
||||
->bind('install_root');
|
||||
|
||||
$controllers->post('/install/', $this->call('doInstall'));
|
||||
$controllers->get('/installer/step2/', $this->call('getInstallForm'))
|
||||
->bind('install_step2');
|
||||
|
||||
$controllers->post('/installer/install/', $this->call('doInstall'));
|
||||
|
||||
return $controllers;
|
||||
}
|
||||
|
||||
public function rootInstaller(Application $app, Request $request)
|
||||
{
|
||||
// $php_constraint = \setup::check_php_version();
|
||||
// $writability_constraints = \setup::check_writability(new \Setup_Registry());
|
||||
// $extension_constraints = \setup::check_php_extension();
|
||||
// $opcode_constraints = \setup::check_cache_opcode();
|
||||
// $php_conf_constraints = \setup::check_php_configuration();
|
||||
// $locales_constraints = \setup::check_system_locales($app);
|
||||
//
|
||||
// $constraints_coll = array(
|
||||
// 'php_constraint' => $php_constraint
|
||||
// , 'writability_constraints' => $writability_constraints
|
||||
// , 'extension_constraints' => $extension_constraints
|
||||
// , 'opcode_constraints' => $opcode_constraints
|
||||
// , 'php_conf_constraints' => $php_conf_constraints
|
||||
// , 'locales_constraints' => $locales_constraints
|
||||
// );
|
||||
$constraints_coll = array(
|
||||
$requirementsCollection = $this->getRequirementsCollection();
|
||||
|
||||
return $app['twig']->render('/setup/index.html.twig', array(
|
||||
'locale' => $app['locale'],
|
||||
'available_locales' => \Alchemy\Phrasea\Application::getAvailableLanguages(),
|
||||
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
|
||||
'requirementsCollection' => $requirementsCollection,
|
||||
));
|
||||
}
|
||||
|
||||
private function getRequirementsCollection()
|
||||
{
|
||||
return array(
|
||||
new \Alchemy\Phrasea\Setup\Requirements\BinariesRequirements(),
|
||||
new \Alchemy\Phrasea\Setup\Requirements\FilesystemRequirements(),
|
||||
new \Alchemy\Phrasea\Setup\Requirements\LocalesRequirements(),
|
||||
@@ -61,33 +60,6 @@ class Installer implements ControllerProviderInterface
|
||||
new \Alchemy\Phrasea\Setup\Requirements\PhraseaRequirements(),
|
||||
new \Alchemy\Phrasea\Setup\Requirements\SystemRequirements(),
|
||||
);
|
||||
// $redirect = true;
|
||||
|
||||
// foreach ($constraints_coll as $key => $constraints) {
|
||||
// $unset = true;
|
||||
// foreach ($constraints as $constraint) {
|
||||
// if (!$constraint->is_ok() && $constraint->is_blocker())
|
||||
// $redirect = $unset = false;
|
||||
// }
|
||||
// if ($unset === true) {
|
||||
// unset($constraints_coll[$key]);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($redirect) {
|
||||
// return $app->redirect('/setup/installer/step2/');
|
||||
// }
|
||||
|
||||
// $app['twig.loader.filesystem']->setPaths(array(
|
||||
// __DIR__ . '/../../../../../templates/web'
|
||||
// ));
|
||||
|
||||
return $app['twig']->render('/setup/index.html.twig', array(
|
||||
'locale' => $app['locale'],
|
||||
'available_locales' => $app->getAvailableLanguages(),
|
||||
'current_servername' => $request->getScheme() . '://' . $request->getHttpHost() . '/',
|
||||
'constraints' => $constraints_coll,
|
||||
));
|
||||
}
|
||||
|
||||
public function getInstallForm(Application $app, Request $request)
|
||||
@@ -96,27 +68,12 @@ class Installer implements ControllerProviderInterface
|
||||
|
||||
$warnings = array();
|
||||
|
||||
$php_constraint = \setup::check_php_version();
|
||||
$writability_constraints = \setup::check_writability(new \Setup_Registry());
|
||||
$extension_constraints = \setup::check_php_extension();
|
||||
$opcode_constraints = \setup::check_cache_opcode();
|
||||
$php_conf_constraints = \setup::check_php_configuration();
|
||||
$locales_constraints = \setup::check_system_locales($app);
|
||||
$requirementsCollection = $this->getRequirementsCollection();
|
||||
|
||||
$constraints_coll = array(
|
||||
'php_constraint' => $php_constraint
|
||||
, 'writability_constraints' => $writability_constraints
|
||||
, 'extension_constraints' => $extension_constraints
|
||||
, 'opcode_constraints' => $opcode_constraints
|
||||
, 'php_conf_constraints' => $php_conf_constraints
|
||||
, 'locales_constraints' => $locales_constraints
|
||||
);
|
||||
|
||||
foreach ($constraints_coll as $key => $constraints) {
|
||||
$unset = true;
|
||||
foreach ($constraints as $constraint) {
|
||||
if (!$constraint->is_ok() && !$constraint->is_blocker()) {
|
||||
$warnings[] = $constraint->get_message();
|
||||
foreach($requirementsCollection as $requirements) {
|
||||
foreach($requirements->getRequirements() as $requirement) {
|
||||
if (!$requirement->isFulfilled() && !$requirement->isOptional()) {
|
||||
$warnings[] = $requirement->getTestMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,7 +86,7 @@ class Installer implements ControllerProviderInterface
|
||||
'/setup/step2.html.twig'
|
||||
, array(
|
||||
'locale' => $app['locale']
|
||||
, 'available_locales' => $app->getAvailableLanguages()
|
||||
, 'available_locales' => Application::getAvailableLanguages()
|
||||
, 'available_templates' => array('en', 'fr')
|
||||
, 'version_number' => $app['phraseanet.version']->getNumber()
|
||||
, 'version_name' => $app['phraseanet.version']->getName()
|
||||
@@ -144,6 +101,7 @@ class Installer implements ControllerProviderInterface
|
||||
public function doInstall(Application $app, Request $request)
|
||||
{
|
||||
set_time_limit(360);
|
||||
|
||||
\phrasea::use_i18n($app['locale']);
|
||||
|
||||
$servername = $request->getScheme() . '://' . $request->getHttpHost() . '/';
|
||||
@@ -179,33 +137,36 @@ class Installer implements ControllerProviderInterface
|
||||
$dataPath = $request->request->get('datapath_noweb');
|
||||
|
||||
try {
|
||||
$installer = new \Alchemy\Phrasea\Setup\Installer($app, $email, $password, $abConn, $servername, $dataPath, $dbConn, $template);
|
||||
$installer = $app['phraseanet.installer'];
|
||||
$installer->setPhraseaIndexerPath($request->request->get('binary_phraseanet_indexer'));
|
||||
|
||||
$binaryData = array();
|
||||
foreach (array(
|
||||
'php_binary' => $request->request->get('binary_php'),
|
||||
'convert_binary' => $request->request->get('binary_convert'),
|
||||
'composite_binary' => $request->request->get('binary_composite'),
|
||||
'swf_extract_binary' => $request->request->get('binary_swfextract'),
|
||||
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
|
||||
'swf_render_binary' => $request->request->get('binary_swfrender'),
|
||||
'unoconv_binary' => $request->request->get('binary_unoconv'),
|
||||
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
|
||||
'mp4box_binary' => $request->request->get('binary_MP4Box'),
|
||||
'pdftotext_binary' => $request->request->get('binary_xpdf'),
|
||||
'php_binary' => $request->request->get('binary_php'),
|
||||
'convert_binary' => $request->request->get('binary_convert'),
|
||||
'composite_binary' => $request->request->get('binary_composite'),
|
||||
'swf_extract_binary' => $request->request->get('binary_swfextract'),
|
||||
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
|
||||
'swf_render_binary' => $request->request->get('binary_swfrender'),
|
||||
'unoconv_binary' => $request->request->get('binary_unoconv'),
|
||||
'ffmpeg_binary' => $request->request->get('binary_ffmpeg'),
|
||||
'mp4box_binary' => $request->request->get('binary_MP4Box'),
|
||||
'pdftotext_binary' => $request->request->get('binary_xpdf'),
|
||||
) as $key => $path) {
|
||||
$installer->addBinaryData($key, $path);
|
||||
$binaryData[$key] = $path;
|
||||
}
|
||||
|
||||
$installer->install();
|
||||
$user = $installer->install($email, $password, $abConn, $servername, $dataPath, $dbConn, $template, $binaryData);
|
||||
|
||||
$app->openAccount(new \Session_Authentication_None($user));
|
||||
//exit;
|
||||
|
||||
$redirection = '/admin/?section=taskmanager¬ice=install_success';
|
||||
|
||||
return $app->redirect($redirection);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
var_dump($e->getMessage(), $e->getFile(), $e->getLine());
|
||||
return $app->redirect('/setup/installer/step2/?error=' . sprintf(_('an error occured : %s'), $e->getMessage()));
|
||||
}
|
||||
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
use Silex\ServiceProviderInterface;
|
||||
use Alchemy\Phrasea\Setup\Installer;
|
||||
|
||||
class InstallerServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
public function register(Application $app)
|
||||
{
|
||||
$app['phraseanet.installer'] = $app->share(function (Application $app) {
|
||||
return new Installer($app);
|
||||
});
|
||||
}
|
||||
|
||||
public function boot(Application $app)
|
||||
{
|
||||
}
|
||||
}
|
@@ -1,5 +1,14 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Alchemy\Phrasea\Core\Provider;
|
||||
|
||||
use Silex\Application;
|
||||
@@ -54,14 +63,17 @@ class PhraseaLocaleServiceProvider implements ServiceProviderInterface
|
||||
);
|
||||
|
||||
$this->app['locale'] = $this->locale = $this->app->share(function(Application $app) use ($event) {
|
||||
$event->getRequest()->setDefaultLocale(
|
||||
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
|
||||
);
|
||||
$event->getRequest()->setLocale(
|
||||
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
|
||||
);
|
||||
|
||||
$languages = $app->getAvailableLanguages();
|
||||
if (isset($app['phraseanet.registry'])) {
|
||||
$event->getRequest()->setDefaultLocale(
|
||||
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
|
||||
);
|
||||
$event->getRequest()->setLocale(
|
||||
$app['phraseanet.registry']->get('GV_default_lng', 'en_GB')
|
||||
);
|
||||
}
|
||||
|
||||
$languages = \Alchemy\Phrasea\Application::getAvailableLanguages();
|
||||
if ($event->getRequest()->cookies->has('locale')
|
||||
&& isset($languages[$event->getRequest()->cookies->get('locale')])) {
|
||||
$event->getRequest()->setLocale($event->getRequest()->cookies->get('locale'));
|
||||
|
@@ -16,52 +16,33 @@ use Doctrine\ORM\Tools\SchemaTool;
|
||||
|
||||
class Installer
|
||||
{
|
||||
private $email;
|
||||
private $password;
|
||||
private $abConn;
|
||||
private $dbConn;
|
||||
private $template;
|
||||
private $app;
|
||||
private $phraseaIndexer;
|
||||
private $serverName;
|
||||
private $dataPath;
|
||||
private $binaryData = array();
|
||||
|
||||
public function __construct(Application $app, $email, $password, \connection_interface $abConn, $serverName, $dataPath, \connection_interface $dbConn = null, $template = null)
|
||||
public function __construct(Application $app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->email = $email;
|
||||
$this->password = $password;
|
||||
$this->abConn = $abConn;
|
||||
$this->dbConn = $dbConn;
|
||||
$this->template = $template;
|
||||
$this->serverName = $serverName;
|
||||
$this->dataPath = $dataPath;
|
||||
}
|
||||
|
||||
public function addBinaryData($key, $path)
|
||||
public function install($email, $password, \connection_interface $abConn, $serverName, $dataPath, \connection_interface $dbConn = null, $template = null, array $binaryData = array())
|
||||
{
|
||||
if ($path) {
|
||||
$this->binaryData[$key] = $path;
|
||||
}
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
$this->rollbackInstall();
|
||||
$this->rollbackInstall($abConn, $dbConn);
|
||||
|
||||
try {
|
||||
|
||||
$this->createConfigFile();
|
||||
$this->createConfigFile($abConn, $serverName, $binaryData);
|
||||
$this->createAB();
|
||||
$this->populateRegistryData();
|
||||
$this->createUser();
|
||||
if ($this->dbConn) {
|
||||
$this->createDB();
|
||||
$this->populateRegistryData($serverName, $dataPath, $binaryData);
|
||||
$user = $this->createUser($email, $password);
|
||||
if (null !== $dbConn) {
|
||||
$this->createDB($dbConn, $template);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$this->rollbackInstall();
|
||||
$this->rollbackInstall($abConn, $dbConn);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function setPhraseaIndexerPath($path)
|
||||
@@ -69,13 +50,13 @@ class Installer
|
||||
$this->phraseaIndexer = $path;
|
||||
}
|
||||
|
||||
private function populateRegistryData()
|
||||
private function populateRegistryData($serverName, $dataPath, $binaryData)
|
||||
{
|
||||
|
||||
$this->app['phraseanet.registry']->set('GV_base_datapath_noweb', $this->dataPath, \registry::TYPE_STRING);
|
||||
$this->app['phraseanet.registry']->set('GV_ServerName', $this->serverName, \registry::TYPE_STRING);
|
||||
$this->app['phraseanet.registry']->set('GV_base_datapath_noweb', $dataPath, \registry::TYPE_STRING);
|
||||
$this->app['phraseanet.registry']->set('GV_ServerName', $serverName, \registry::TYPE_STRING);
|
||||
|
||||
foreach ($this->binaryData as $key => $value) {
|
||||
foreach ($binaryData as $key => $value) {
|
||||
$this->app['phraseanet.registry']->set($key, $value, \registry::TYPE_STRING);
|
||||
}
|
||||
|
||||
@@ -92,10 +73,10 @@ class Installer
|
||||
}
|
||||
}
|
||||
|
||||
private function createDB()
|
||||
private function createDB(\connection_interface $dbConn = null, $template)
|
||||
{
|
||||
$template = new \SplFileInfo(__DIR__ . '/../../../conf.d/data_templates/' . $this->template . '-simple.xml');
|
||||
$databox = \databox::create($this->app, $this->dbConn, $template, $this->app['phraseanet.registry']);
|
||||
$template = new \SplFileInfo(__DIR__ . '/../../../conf.d/data_templates/' . $template . '-simple.xml');
|
||||
$databox = \databox::create($this->app, $dbConn, $template, $this->app['phraseanet.registry']);
|
||||
$this->app['phraseanet.user']->ACL()
|
||||
->give_access_to_sbas(array($databox->get_sbas_id()))
|
||||
->update_rights_to_sbas(
|
||||
@@ -145,14 +126,16 @@ class Installer
|
||||
}
|
||||
}
|
||||
|
||||
private function createUser()
|
||||
private function createUser($email, $password)
|
||||
{
|
||||
$user = \User_Adapter::create($this->app, $this->email, $this->password, $this->email, true);
|
||||
$user = \User_Adapter::create($this->app, $email, $password, $email, true);
|
||||
|
||||
$this->app['session']->set('usr_id', $user->get_id());
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
private function rollbackInstall()
|
||||
private function rollbackInstall(\connection_interface $abConn, \connection_interface $dbConn = null)
|
||||
{
|
||||
$structure = simplexml_load_file(__DIR__ . "/../../../conf.d/bases_structure.xml");
|
||||
|
||||
@@ -166,18 +149,18 @@ class Installer
|
||||
foreach ($appbox->tables->table as $table) {
|
||||
try {
|
||||
$sql = 'DROP TABLE `' . $table['name'] . '`';
|
||||
$stmt = $this->abConn->prepare($sql);
|
||||
$stmt = $abConn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
} catch (\PDOException $e) {
|
||||
|
||||
}
|
||||
}
|
||||
if ($this->dbConn) {
|
||||
if (null !== $dbConn) {
|
||||
foreach ($databox->tables->table as $table) {
|
||||
try {
|
||||
$sql = 'DROP TABLE `' . $table['name'] . '`';
|
||||
$stmt = $this->dbConn->prepare($sql);
|
||||
$stmt = $dbConn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
} catch (\PDOException $e) {
|
||||
@@ -208,13 +191,13 @@ class Installer
|
||||
$this->app['phraseanet.registry'] = new \registry($this->app);
|
||||
}
|
||||
|
||||
private function createConfigFile()
|
||||
private function createConfigFile($abConn, $serverName, $binaryData)
|
||||
{
|
||||
$this->app['phraseanet.configuration']->initialize();
|
||||
|
||||
$connexionINI = array();
|
||||
|
||||
foreach ($this->abConn->get_credentials() as $key => $value) {
|
||||
foreach ($abConn->get_credentials() as $key => $value) {
|
||||
$key = $key == 'hostname' ? 'host' : $key;
|
||||
$connexionINI[$key] = (string) $value;
|
||||
}
|
||||
@@ -222,8 +205,6 @@ class Installer
|
||||
$connexionINI['driver'] = 'pdo_mysql';
|
||||
$connexionINI['charset'] = 'UTF8';
|
||||
|
||||
$serverName = $this->serverName;
|
||||
|
||||
$connexion = array(
|
||||
'main_connexion' => $connexionINI,
|
||||
'test_connexion' => array(
|
||||
@@ -267,6 +248,6 @@ class Installer
|
||||
}
|
||||
|
||||
$this->app['phraseanet.configuration']->setConfigurations($arrayConf, $arrayConf['environment']);
|
||||
$this->app['phraseanet.configuration']->setBinaries(array('binaries' => $this->binaryData));
|
||||
$this->app['phraseanet.configuration']->setBinaries(array('binaries' => $binaryData));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user