diff --git a/bin/setup b/bin/setup
new file mode 100755
index 0000000000..e60040b890
--- /dev/null
+++ b/bin/setup
@@ -0,0 +1,71 @@
+#!/usr/bin/env php
+command(new \module_console_aboutAuthors('about:authors'));
+ $app->command(new \module_console_aboutLicense('about:license'));
+
+ if ($tester->isInstalled()) {
+ $app->command(new \module_console_systemUpgrade('system:upgrade'));
+ $app->command(new UpgradeDBDatas('system:upgrade-datas'));
+ }
+
+ $app->command(new \module_console_systemConfigCheck('check:system'));
+ $app->command(new \Alchemy\Phrasea\Command\Setup\Install('system:install'));
+
+ $result_code = is_int($app->run()) ? : 1;
+} catch (\Exception $e) {
+ $result_code = 1;
+ echo sprintf("\nAn error occured :\n\n\t\033[0;31m%s\033[0;37m\n\n", $e->getMessage());
+}
+
+exit($result_code);
diff --git a/hudson/config.yml b/hudson/config.yml
deleted file mode 100755
index c6ff86b2cc..0000000000
--- a/hudson/config.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-environment: dev
-dev:
- phraseanet:
- servername: 'http://local.phrasea/'
- maintenance: false
- debug: true
- display_errors: true
- database: main_connexion
- template_engine: twig_debug
- orm: doctrine_dev
- cache: array_cache
- opcodecache: array_cache
- border-manager: border_manager
-prod:
- phraseanet:
- servername: 'http://local.phrasea/'
- maintenance: false
- debug: false
- display_errors: false
- database: main_connexion
- template_engine: twig
- orm: doctrine_prod
- cache: array_cache
- opcodecache: array_cache
- border-manager: border_manager
-test:
- phraseanet:
- servername: 'http://local.phrasea/'
- maintenance: false
- debug: true
- display_errors: true
- database: main_connexion
- template_engine: twig_debug
- orm: doctrine_test
- cache: array_cache
- opcodecache: array_cache
- border-manager: border_manager
diff --git a/hudson/connexions.yml b/hudson/connexions.yml
deleted file mode 100755
index c429f9507f..0000000000
--- a/hudson/connexions.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-main_connexion:
- host: localhost
- port: '3306'
- user: root
- password: ''
- dbname: ab_test
- driver: pdo_mysql
- charset: UTF8
-test_connexion:
- driver: pdo_sqlite
- path: '/tmp/db.sqlite'
- charset: UTF8
diff --git a/hudson/services.yml b/hudson/services.yml
deleted file mode 100755
index 13dfc489b2..0000000000
--- a/hudson/services.yml
+++ /dev/null
@@ -1,179 +0,0 @@
-
-Orm:
- #Doctrine developement service options
- #Service name
- doctrine_dev:
- type: Orm\Doctrine
- options:
- #Set automatically propers values for debug
- #Query & result caches are setted to Array cache
- #Auto-generating Proxy Classes is setted to false
- debug: true
- #Assign a connexion from connexions.yml to the DataBase Abstraction Layer
- dbal: main_connexion
- #Available cache driver [memcached, apc, array]
- #Query cache : is used to cache the transformation of a DQL query to its SQL counterpart
- #Result cache : is used to cache the results of your queries
- #Metadata cache : is used to cache entity class metadatas
- #If No cache is provided all cache are setted to default_cache which is an array cache type
- cache:
- query:
- service: Cache\array_cache
- result:
- service: Cache\array_cache
- metadata:
- service: Cache\array_cache
- # Assign a service to log doctrine queries
- log:
- service: Log\query_logger
-
- # Doctrine test service options
- doctrine_test:
- type: Orm\Doctrine
- options:
- debug: true
- #Doctrine use a different connection configuration base to run tests
- dbal: test_connexion
- cache:
- query:
- service: Cache\array_cache
- result:
- service: Cache\array_cache
- metadata:
- service: Cache\array_cache
-
- # Doctrine production service options
- doctrine_prod:
- type: Orm\Doctrine
- options:
- debug: false
- dbal: main_connexion
- cache:
- query:
- service: Cache\array_cache
- result:
- service: Cache\array_cache
- metadata:
- service: Cache\array_cache
-
-TemplateEngine:
- #Define a template engine service
- #Only Twig is avalaible as a template engine service
- #see http://twig.sensiolabs.org/
-
- #Define the service name first
- twig:
- #Template engine type
- type: TemplateEngine\Twig
- options:
- #When set to true, the generated templates have a __toString() method that you can use to display the generated nodes
- debug: false
- #The charset used by the templates
- charset: utf-8
- #Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist)
- #And replace them with a null value. When set to true, Twig throws an exception instead (default to false)
- strict_variables: false
- autoescape: true
- #Optimize the node tree before compilation
- optimizer: true
-
- twig_debug:
- type: TemplateEngine\Twig
- options:
- debug: true
- charset: utf-8
- strict_variables: true
- autoescape: true
- optimizer: true
-
-
-Log:
- # Define a Log service
- # This one is defined to handle the logs of doctrine queries
- # Only Monolog is available as a logger service
- # Please Notice that for doctrine ONLY a echo logger service is available, see below
- # Monolog logger use the PHP Monolog library to handle logs using differents handlers
- query_logger:
- type: Log\Doctrine\Monolog
- options:
- #You can precise the output format
- #This option is only available when log are used to log doctrine queries
- #Available output [vdump, json, yaml]
- # vdump : output logs in a var_dump formatted style
- # json : output logs in json
- # yml : output logs yml
- output: json
- #Name used for the Monolog channel
- channel: query-logger
- #Define how the logs will be handled
- #Avalaibale Handler are [rotate, stream]
- #Rotate handler is used to stores logs to files that are rotated every day
- #And a limited number of files are kept by defining the max_day value
- #Stream handler is used to stores logs in a single local file
- handler: rotate
- max_day: 2
- #Name of the file where logs are written
- filename: doctrine-query.log
-
- # Define a phpecho log service for Doctrine
- # phpecho logger logs doctrine queries to the standard output using echo/var_dump
- # Notice that phpecho logger do not have options
- sql_logger:
- type: Log\Doctrine\Phpecho
-
-Cache:
- #Define cache services
- #There are Four deffirent cache type available [array, xcache, apc, memcache]
- #Only a memcache service can take option to define port & host for the memcache server
- array_cache:
- type: Cache\ArrayCache
-
- memcache_cache:
- type: Cache\MemcacheCache
- options:
- host: localhost
- port: 11211
-
- apc_cache:
- type: Cache\ApcCache
-
- xcache_cache:
- type: Cache\XcacheCache
-
-Border:
- border_manager:
- type: Border\BorderManager
- options:
- enabled: true
- checkers:
- -
- type: Checker\Sha256
- enabled: true
- -
- type: Checker\UUID
- enabled: true
- -
- type: Checker\Colorspace
- enabled: false
- options:
- colorspaces: [cmyk, grayscale, rgb]
- -
- type: Checker\Dimension
- enabled: false
- options:
- width: 80
- height: 80
- -
- type: Checker\Extension
- enabled: false
- options: { }
- -
- type: Checker\Filename
- enabled: false
- options:
- sensitive: true
- -
- type: Checker\MediaType
- enabled: false
- options:
- mediatypes: [Audio, Document, Flash, Image, Video]
diff --git a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php b/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php
deleted file mode 100644
index 3491f26d90..0000000000
--- a/lib/Alchemy/Phrasea/Controller/Setup/Upgrader.php
+++ /dev/null
@@ -1,69 +0,0 @@
-get('/', function() use ($app) {
- require_once __DIR__ . '/../../../../bootstrap.php';
- $upgrade_status = \Setup_Upgrade::get_status();
-
- return $app['twig']->render(
- '/setup/upgrader.html.twig'
- , array(
- 'locale' => $app['locale']
- , 'upgrade_status' => $upgrade_status
- , 'available_locales' => $app->getAvailableLanguages()
- , 'bad_users' => \User_Adapter::get_wrong_email_users($app)
- , 'version_number' => $app['phraseanet.version']->getNumber()
- , 'version_name' => $app['phraseanet.version']->getName()
- )
- );
- });
-
- $controllers->get('/status/', function(Application $app) {
- require_once __DIR__ . '/../../../../bootstrap.php';
-
- return $app->json(\Setup_Upgrade::get_status());
- });
-
- $controllers->post('/execute/', function(Application $app) {
- require_once __DIR__ . '/../../../../bootstrap.php';
- set_time_limit(0);
- session_write_close();
- ignore_user_abort(true);
-
- $upgrader = new \Setup_Upgrade($app);
- $app['phraseanet.appbox']->forceUpgrade($upgrader, $app);
-
- /**
- * @todo Show recomandation instead of redirect
- */
- return $app->redirect('/');
- });
-
- return $controllers;
- }
-}
diff --git a/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php b/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php
new file mode 100644
index 0000000000..5f3f176964
--- /dev/null
+++ b/lib/Alchemy/Phrasea/Setup/ConfigurationTester.php
@@ -0,0 +1,36 @@
+app = $app;
+
+ }
+
+ public function registerProbe(ProbeInterface $probe)
+ {
+ $this->probes[] = $probe;
+ }
+
+ public function isInstalled()
+ {
+ return file_exists(__DIR__ . '/../../../../config/config.yml')
+ && file_exists(__DIR__ . '/../../../../config/connexions.yml')
+ && file_exists(__DIR__ . '/../../../../config/services.yml');
+ }
+
+ public function probeIsMigrable()
+ {
+
+ }
+}
diff --git a/lib/classes/module/console/aboutAuthors.class.php b/lib/classes/module/console/aboutAuthors.class.php
index 6a93e9fbb4..d9fb6b77f7 100644
--- a/lib/classes/module/console/aboutAuthors.class.php
+++ b/lib/classes/module/console/aboutAuthors.class.php
@@ -38,8 +38,4 @@ class module_console_aboutAuthors extends Command
return 0;
}
- public function requireSetup()
- {
- return false;
- }
}
diff --git a/lib/classes/module/console/aboutLicense.class.php b/lib/classes/module/console/aboutLicense.class.php
index eed159d345..4b02962f3d 100644
--- a/lib/classes/module/console/aboutLicense.class.php
+++ b/lib/classes/module/console/aboutLicense.class.php
@@ -37,9 +37,4 @@ class module_console_aboutLicense extends Command
return 0;
}
-
- public function requireSetup()
- {
- return false;
- }
}
diff --git a/lib/classes/module/console/checkExtension.class.php b/lib/classes/module/console/checkExtension.class.php
index daf8c0720f..4874c033aa 100644
--- a/lib/classes/module/console/checkExtension.class.php
+++ b/lib/classes/module/console/checkExtension.class.php
@@ -36,11 +36,6 @@ class module_console_checkExtension extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ( ! extension_loaded('phrasea2')) {
diff --git a/lib/classes/module/console/fieldsDelete.class.php b/lib/classes/module/console/fieldsDelete.class.php
index 276079da6a..f06ef68110 100644
--- a/lib/classes/module/console/fieldsDelete.class.php
+++ b/lib/classes/module/console/fieldsDelete.class.php
@@ -35,11 +35,6 @@ class module_console_fieldsDelete extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
diff --git a/lib/classes/module/console/fieldsList.class.php b/lib/classes/module/console/fieldsList.class.php
index c6fd52765e..da15ab33e1 100644
--- a/lib/classes/module/console/fieldsList.class.php
+++ b/lib/classes/module/console/fieldsList.class.php
@@ -31,11 +31,6 @@ class module_console_fieldsList extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
diff --git a/lib/classes/module/console/fieldsMerge.class.php b/lib/classes/module/console/fieldsMerge.class.php
index 838104d106..c5c89d701c 100644
--- a/lib/classes/module/console/fieldsMerge.class.php
+++ b/lib/classes/module/console/fieldsMerge.class.php
@@ -45,11 +45,6 @@ class module_console_fieldsMerge extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln("");
diff --git a/lib/classes/module/console/fieldsRename.class.php b/lib/classes/module/console/fieldsRename.class.php
index b345e242a6..c2d3bc5ced 100644
--- a/lib/classes/module/console/fieldsRename.class.php
+++ b/lib/classes/module/console/fieldsRename.class.php
@@ -36,11 +36,6 @@ class module_console_fieldsRename extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$new_name = $input->getArgument('name');
diff --git a/lib/classes/module/console/fileEnsureDevSetting.class.php b/lib/classes/module/console/fileEnsureDevSetting.class.php
index fd911bec95..e4b74136dd 100644
--- a/lib/classes/module/console/fileEnsureDevSetting.class.php
+++ b/lib/classes/module/console/fileEnsureDevSetting.class.php
@@ -57,11 +57,6 @@ class module_console_fileEnsureDevSetting extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$this->configuration = $this->container['phraseanet.configuration'];
diff --git a/lib/classes/module/console/fileEnsureProductionSetting.class.php b/lib/classes/module/console/fileEnsureProductionSetting.class.php
index 6bd24e8969..6d4aca0fee 100644
--- a/lib/classes/module/console/fileEnsureProductionSetting.class.php
+++ b/lib/classes/module/console/fileEnsureProductionSetting.class.php
@@ -57,11 +57,6 @@ class module_console_fileEnsureProductionSetting extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$this->configuration = $this->container['phraseanet.configuration'];
diff --git a/lib/classes/module/console/schedulerStart.class.php b/lib/classes/module/console/schedulerStart.class.php
index 1161c51c02..b53db75dab 100644
--- a/lib/classes/module/console/schedulerStart.class.php
+++ b/lib/classes/module/console/schedulerStart.class.php
@@ -34,11 +34,6 @@ class module_console_schedulerStart extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$logger = new Logger('Task logger');
diff --git a/lib/classes/module/console/schedulerState.class.php b/lib/classes/module/console/schedulerState.class.php
index 3b434b5637..8f41ca449f 100644
--- a/lib/classes/module/console/schedulerState.class.php
+++ b/lib/classes/module/console/schedulerState.class.php
@@ -49,16 +49,9 @@ class module_console_schedulerState extends Command
return $this;
}
- public function requireSetup()
- {
- return false;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
- try {
- $this->checkSetup();
- } catch (\RuntimeException $e) {
+ if (!$this->container['phraseanet.configuration']->isInstalled()) {
return self::EXITCODE_SETUP_ERROR;
}
diff --git a/lib/classes/module/console/schedulerStop.class.php b/lib/classes/module/console/schedulerStop.class.php
index 7395ee1f8b..d64c74f101 100644
--- a/lib/classes/module/console/schedulerStop.class.php
+++ b/lib/classes/module/console/schedulerStop.class.php
@@ -31,11 +31,6 @@ class module_console_schedulerStop extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
try {
diff --git a/lib/classes/module/console/sphinxGenerateSuggestion.class.php b/lib/classes/module/console/sphinxGenerateSuggestion.class.php
index 377cc66eec..1dffcf268b 100644
--- a/lib/classes/module/console/sphinxGenerateSuggestion.class.php
+++ b/lib/classes/module/console/sphinxGenerateSuggestion.class.php
@@ -31,11 +31,6 @@ class module_console_sphinxGenerateSuggestion extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
define('FREQ_THRESHOLD', 10);
diff --git a/lib/classes/module/console/systemBackupDB.class.php b/lib/classes/module/console/systemBackupDB.class.php
index 4af2b51e0d..392f961388 100644
--- a/lib/classes/module/console/systemBackupDB.class.php
+++ b/lib/classes/module/console/systemBackupDB.class.php
@@ -38,11 +38,6 @@ class module_console_systemBackupDB extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->write('Phraseanet is going to be backup...', true);
diff --git a/lib/classes/module/console/systemClearCache.class.php b/lib/classes/module/console/systemClearCache.class.php
index e22fef74fa..b14ec665b0 100644
--- a/lib/classes/module/console/systemClearCache.class.php
+++ b/lib/classes/module/console/systemClearCache.class.php
@@ -32,11 +32,6 @@ class module_console_systemClearCache extends Command
return $this;
}
- public function requireSetup()
- {
- return false;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$finder = new Finder();
diff --git a/lib/classes/module/console/systemConfigCheck.class.php b/lib/classes/module/console/systemConfigCheck.class.php
index 249ccc7878..a1fedbc7f2 100644
--- a/lib/classes/module/console/systemConfigCheck.class.php
+++ b/lib/classes/module/console/systemConfigCheck.class.php
@@ -32,11 +32,6 @@ class module_console_systemConfigCheck extends Command
return $this;
}
- public function requireSetup()
- {
- return false;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
if ( ! function_exists('_')) {
diff --git a/lib/classes/module/console/systemExport.class.php b/lib/classes/module/console/systemExport.class.php
index b838a7180e..6602ec0b93 100644
--- a/lib/classes/module/console/systemExport.class.php
+++ b/lib/classes/module/console/systemExport.class.php
@@ -71,11 +71,6 @@ class module_console_systemExport extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$docPerDir = max(1, (int) $input->getOption('docperdir'));
diff --git a/lib/classes/module/console/systemMailCheck.class.php b/lib/classes/module/console/systemMailCheck.class.php
index abccf165b0..d0d514abdc 100644
--- a/lib/classes/module/console/systemMailCheck.class.php
+++ b/lib/classes/module/console/systemMailCheck.class.php
@@ -37,11 +37,6 @@ class module_console_systemMailCheck extends Command
return $this;
}
- public function requireSetup()
- {
- return true;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$output->writeln("Processing...");
diff --git a/lib/classes/module/console/systemTemplateGenerator.class.php b/lib/classes/module/console/systemTemplateGenerator.class.php
index 08b945c0dc..68da073af9 100644
--- a/lib/classes/module/console/systemTemplateGenerator.class.php
+++ b/lib/classes/module/console/systemTemplateGenerator.class.php
@@ -33,11 +33,6 @@ class module_console_systemTemplateGenerator extends Command
return $this;
}
- public function requireSetup()
- {
- return false;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
$tplDirs = array(
diff --git a/lib/classes/module/console/systemUpgrade.class.php b/lib/classes/module/console/systemUpgrade.class.php
index 7e794252d3..15c9264b42 100644
--- a/lib/classes/module/console/systemUpgrade.class.php
+++ b/lib/classes/module/console/systemUpgrade.class.php
@@ -36,51 +36,22 @@ class module_console_systemUpgrade extends Command
return $this;
}
- public function requireSetup()
- {
- return false;
- }
-
protected function doExecute(InputInterface $input, OutputInterface $output)
{
require_once dirname(__FILE__) . '/../../../../lib/bootstrap.php';
$interactive = !$input->getOption('yes');
- if (!$this->container['phraseanet.configuration']->isInstalled() && \setup::needUpgradeConfigurationFile()) {
-
- if ($interactive) {
- $output->writeln('This version of Phraseanet requires a config/config.yml, config/connexion.yml, config/service.yml');
- $output->writeln('Would you like it to be created based on your settings ?');
-
- $dialog = $this->getHelperSet()->get('dialog');
- do {
- $continue = mb_strtolower($dialog->ask($output, '