mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Use configuration tester
This commit is contained in:
@@ -16,6 +16,7 @@ use Alchemy\Phrasea\Core\Provider\BrowserServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\BorderManagerServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\CacheServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\ConfigurationTesterServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\GeonamesServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\ORMServiceProvider;
|
||||
use Alchemy\Phrasea\Core\Provider\TaskManagerServiceProvider;
|
||||
@@ -109,6 +110,7 @@ class Application extends SilexApplication
|
||||
$this->register(new BorderManagerServiceProvider());
|
||||
$this->register(new BrowserServiceProvider());
|
||||
$this->register(new ConfigurationServiceProvider());
|
||||
$this->register(new ConfigurationTesterServiceProvider);
|
||||
$this->register(new CacheServiceProvider());
|
||||
$this->register(new ImagineServiceProvider());
|
||||
$this->register(new FFMpegServiceProvider());
|
||||
|
@@ -178,16 +178,6 @@ class Configuration
|
||||
return new ParameterBag($this->configuration->get('phraseanet'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell if the application is installed
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInstalled()
|
||||
{
|
||||
return $this->specifications->isSetup();
|
||||
}
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
$this->specifications->initialize();
|
||||
|
@@ -16,7 +16,7 @@ class Firewall
|
||||
|
||||
public function requireSetUp()
|
||||
{
|
||||
if (!\setup::is_installed()) {
|
||||
if (!$this->app['phraseanet.configuration-tester']->isInstalled()) {
|
||||
return $this->app->redirect("/setup/");
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ class module_console_schedulerState extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if (!$this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
return self::EXITCODE_SETUP_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -48,7 +48,7 @@ class module_console_systemClearCache extends Command
|
||||
|
||||
$filesystem->remove($finder);
|
||||
|
||||
if ($this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if ($this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$this->getService('phraseanet.cache-service')->flushAll();
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,7 @@ class module_console_systemConfigCheck extends Command
|
||||
|
||||
$ok = true;
|
||||
|
||||
if ($this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if ($this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$registry = $this->container['phraseanet.registry'];
|
||||
|
||||
$output->writeln(_('*** CHECK BINARY CONFIGURATION ***'));
|
||||
|
@@ -50,7 +50,7 @@ class module_console_systemUpgrade extends Command
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->getService('phraseanet.configuration')->isInstalled()) {
|
||||
if (!$this->getService('phraseanet.configuration-tester')->isInstalled()) {
|
||||
throw new \RuntimeException('Phraseanet must be set-up');
|
||||
}
|
||||
|
||||
|
@@ -59,7 +59,7 @@ class module_console_taskState extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if (!$this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
return self::EXITCODE_SETUP_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -34,7 +34,7 @@ class module_console_tasklist extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if (!$this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
return self::EXITCODE_SETUP_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -65,7 +65,7 @@ class module_console_taskrun extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
if (!$this->container['phraseanet.configuration']->isInstalled()) {
|
||||
if (!$this->container['phraseanet.configuration-tester']->isInstalled()) {
|
||||
return self::EXITCODE_SETUP_ERROR;
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,7 @@ class registry implements registryInterface
|
||||
$this->cache = new ArrayCache();
|
||||
|
||||
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
|
||||
if ($app['phraseanet.configuration']->isInstalled()) {
|
||||
if ($app['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$this->cache->save('GV_ServerName', $app['phraseanet.configuration']->getPhraseanet()->get('servername'));
|
||||
$this->cache->save('GV_debug', $app['phraseanet.configuration']->isDebug());
|
||||
$this->cache->save('GV_maintenance', $app['phraseanet.configuration']->isMaintained());
|
||||
|
@@ -72,80 +72,6 @@ class setup
|
||||
, 'magic_quotes_gpc' => 'off' //INI_PER_DIR -- just for check
|
||||
);
|
||||
|
||||
public static function is_installed()
|
||||
{
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
return $appConf->isSetup();
|
||||
}
|
||||
|
||||
public static function needUpgradeConfigurationFile()
|
||||
{
|
||||
return (is_file(__DIR__ . "/../../config/connexion.inc")
|
||||
&& is_file(__DIR__ . "/../../config/config.inc") ||
|
||||
self::requireGVUpgrade());
|
||||
}
|
||||
|
||||
public static function requireGVUpgrade()
|
||||
{
|
||||
return is_file(__DIR__ . "/../../config/connexion.inc")
|
||||
&& is_file(__DIR__ . "/../../config/_GV.php")
|
||||
&& !is_file(__DIR__ . "/../../config/config.inc");
|
||||
}
|
||||
|
||||
public static function upgradeGV(registryInterface $registry)
|
||||
{
|
||||
$GV = array();
|
||||
if (is_file(__DIR__ . '/../../config/_GV.php')) {
|
||||
require __DIR__ . '/../../config/_GV.php';
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
require __DIR__ . '/../../lib/conf.d/_GV_template.inc';
|
||||
|
||||
define('GV_STATIC_URL', '');
|
||||
define('GV_sphinx', false);
|
||||
define('GV_sphinx_host', '');
|
||||
define('GV_sphinx_port', '');
|
||||
define('GV_sphinx_rt_host', '');
|
||||
define('GV_sphinx_rt_port', '');
|
||||
|
||||
foreach ($GV as $section => $datas_section) {
|
||||
foreach ($datas_section['vars'] as $datas) {
|
||||
|
||||
$registry->un_set($datas['name']);
|
||||
eval('$test = defined("' . $datas["name"] . '");');
|
||||
if (!$test) {
|
||||
continue;
|
||||
}
|
||||
eval('$val = ' . $datas["name"] . ';');
|
||||
|
||||
$val = $val === true ? '1' : $val;
|
||||
$val = $val === false ? '0' : $val;
|
||||
|
||||
switch ($datas['type']) {
|
||||
case registry::TYPE_ENUM_MULTI:
|
||||
case registry::TYPE_INTEGER:
|
||||
case registry::TYPE_BOOLEAN:
|
||||
case registry::TYPE_STRING:
|
||||
case registry::TYPE_ARRAY:
|
||||
$type = $datas['type'];
|
||||
break;
|
||||
default:
|
||||
$type = registry::TYPE_STRING;
|
||||
break;
|
||||
}
|
||||
$registry->set($datas['name'], $val, $type);
|
||||
}
|
||||
}
|
||||
$registry->un_set('registry_loaded');
|
||||
|
||||
rename(__DIR__ . '/../../config/_GV.php', __DIR__ . '/../../config/_GV.php.old');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public static function create_global_values(Application $app, $datas = array())
|
||||
{
|
||||
require(__DIR__ . "/../../lib/conf.d/_GV_template.inc");
|
||||
@@ -614,45 +540,4 @@ class setup
|
||||
|
||||
return $current;
|
||||
}
|
||||
|
||||
public static function rollback(connection_pdo $conn, connection_pdo $connbas = null)
|
||||
{
|
||||
$structure = simplexml_load_file(__DIR__ . "/../../lib/conf.d/bases_structure.xml");
|
||||
|
||||
if (!$structure) {
|
||||
throw new Exception('Unable to load schema');
|
||||
}
|
||||
|
||||
$appbox = $structure->appbox;
|
||||
$databox = $structure->databox;
|
||||
|
||||
foreach ($appbox->tables->table as $table) {
|
||||
try {
|
||||
$sql = 'DROP TABLE `' . $table['name'] . '`';
|
||||
$stmt = $conn->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
if ($connbas) {
|
||||
foreach ($databox->tables->table as $table) {
|
||||
try {
|
||||
$sql = 'DROP TABLE `' . $table['name'] . '`';
|
||||
$stmt = $connbas->prepare($sql);
|
||||
$stmt->execute();
|
||||
$stmt->closeCursor();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
$appConf->delete();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,7 @@ foreach ($lngs as $lng => $locales) {
|
||||
|
||||
$extractDateFields = function(Application $app) {
|
||||
$date_sort_fields = array('' => '');
|
||||
if ($app['phraseanet.configuration']->isInstalled()) {
|
||||
if ($app['phraseanet.configuration-tester']->isInstalled()) {
|
||||
$ProdHelper = new Prod($app, Request::createFromGlobals());
|
||||
$datas = $ProdHelper->get_search_datas();
|
||||
foreach ($datas['dates'] as $date) {
|
||||
|
Reference in New Issue
Block a user