From 2427b7a6b473ccff47a0e1c004c5d88019bec994 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 12:39:04 +0200 Subject: [PATCH 01/10] Fix #1265 : Provide login in forgot password email --- lib/Alchemy/Phrasea/Controller/Root/Login.php | 1 + .../Mail/MailRequestPasswordUpdate.php | 21 +++++++++++- .../Mail/MailRequestPasswordUpdateTest.php | 32 ++++++++++++++++++- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php index b4123ac171..d235893e46 100644 --- a/lib/Alchemy/Phrasea/Controller/Root/Login.php +++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php @@ -603,6 +603,7 @@ class Login implements ControllerProviderInterface $url = $app->url('login_renew_password', array('token' => $token), true); $mail = MailRequestPasswordUpdate::create($app, $receiver); + $mail->setLogin($user->get_login()); $mail->setButtonUrl($url); $app['notification.deliverer']->deliver($mail); diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php index f3c0760aae..38507ff139 100644 --- a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php +++ b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php @@ -11,8 +11,23 @@ namespace Alchemy\Phrasea\Notification\Mail; +use Alchemy\Phrasea\Exception\LogicException; + class MailRequestPasswordUpdate extends AbstractMailWithLink { + /** @var string */ + private $login; + + /** + * Sets the login related to the password renewal + * + * @param string $login + */ + public function setLogin($login) + { + $this->login = $login; + } + /** * {@inheritdoc} */ @@ -26,7 +41,11 @@ class MailRequestPasswordUpdate extends AbstractMailWithLink */ public function getMessage() { - return _('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ') + if (!$this->login) { + throw new LogicException('You must set a login before calling getMessage'); + } + + return sprintf(_('Password renewal for login "%s" has been requested'), $this->login) . "\n" . _('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien'); } diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php index a4be2fe1ac..cfcd519715 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php @@ -3,15 +3,22 @@ namespace Alchemy\Tests\Phrasea\Notification\Mail; use Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate; +use Alchemy\Phrasea\Exception\LogicException; /** * @covers Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate */ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase { + public function testSetLogin() + { + $mail = $this->getMail(); + $this->assertTrue(false !== strpos($mail->getMessage(), 'RomainNeutron')); + } + public function getMail() { - return MailRequestPasswordUpdate::create( + $mail = MailRequestPasswordUpdate::create( $this->getApp(), $this->getReceiverMock(), $this->getEmitterMock(), @@ -19,5 +26,28 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase $this->getUrl(), $this->getExpiration() ); + + $mail->setLogin('RomainNeutron'); + + return $mail; + } + + public function testThatALogicExceptionIsThrownIfNoLoginProvided() + { + $mail = MailRequestPasswordUpdate::create( + $this->getApp(), + $this->getReceiverMock(), + $this->getEmitterMock(), + $this->getMessage(), + $this->getUrl(), + $this->getExpiration() + ); + + try { + $mail->getMessage(); + $this->fail('Should have raised an exception'); + } catch (LogicException $e) { + + } } } From bb62b43494ae0151ccc27b1f514da735fa092e84 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 12:42:23 +0200 Subject: [PATCH 02/10] Fix #1262 : Add timeout on backup db process --- lib/classes/module/console/systemBackupDB.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/classes/module/console/systemBackupDB.php b/lib/classes/module/console/systemBackupDB.php index 71939f6584..ee6db8de4d 100644 --- a/lib/classes/module/console/systemBackupDB.php +++ b/lib/classes/module/console/systemBackupDB.php @@ -35,6 +35,7 @@ class module_console_systemBackupDB extends Command $this ->setDescription('Backup Phraseanet Databases') ->addArgument('directory', null, 'The directory where to backup', $dir) + ->addOption('timeout', 't', null, 'The timeout for this command (default is 3600s / 1h). Set 0 to disable timeout.', 3600) ->addOption('gzip', 'g', null, 'Gzip the output (requires gzip utility)') ->addOption('bzip', 'b', null, 'Bzip the output (requires bzip2 utility)'); @@ -89,6 +90,7 @@ class module_console_systemBackupDB extends Command $command .= ' > ' . escapeshellarg($filename); $process = new Process($command); + $process->setTimeout((int) $input->getOption('timeout')); $process->run(); if (!$process->isSuccessful()) { From 70cb9ee06be9d449e5a8f85d672f850863de5145 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 12:49:21 +0200 Subject: [PATCH 03/10] Fix #1245 : Rename trials-before-failure configuration to trials-before-display --- config/configuration.sample.yml | 2 +- .../AuthenticationManagerServiceProvider.php | 2 +- lib/Alchemy/Phrasea/Core/Version.php | 2 +- lib/classes/patch/3817.php | 66 +++++++++++++++++++ lib/conf.d/configuration.yml | 2 +- .../Fixtures/configuration-setup.yml | 2 +- .../Configuration/Fixtures/configuration.yml | 2 +- .../Fixtures/configuration-debugger.yml | 2 +- .../Fixtures/configuration-maintenance.yml | 2 +- ...thenticationManagerServiceProviderTest.php | 2 +- .../Version/Migration/Migration38Test.php | 2 +- 11 files changed, 76 insertions(+), 10 deletions(-) create mode 100644 lib/classes/patch/3817.php diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index b8ab08146a..c638e5270f 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -86,7 +86,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index 51174ba1c8..6e5a74b454 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -101,7 +101,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface $app['auth.native.failure-manager'] = $app->share(function (Application $app) { $authConf = $app['phraseanet.configuration']['authentication']['captcha']; - return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-failure']) ? $authConf['trials-before-failure'] : 9); + return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-display']) ? $authConf['trials-before-display'] : 9); }); $app['auth.password-checker'] = $app->share(function (Application $app) { diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php index 5a26a347e8..3c0893c844 100644 --- a/lib/Alchemy/Phrasea/Core/Version.php +++ b/lib/Alchemy/Phrasea/Core/Version.php @@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core; */ class Version { - protected static $number = '3.8.0.a16'; + protected static $number = '3.8.0.a17'; protected static $name = 'Carnosaurus'; public static function getNumber() diff --git a/lib/classes/patch/3817.php b/lib/classes/patch/3817.php new file mode 100644 index 0000000000..9a6571690f --- /dev/null +++ b/lib/classes/patch/3817.php @@ -0,0 +1,66 @@ +release; + } + + /** + * {@inheritdoc} + */ + public function require_all_upgrades() + { + return false; + } + + /** + * {@inheritdoc} + */ + public function concern() + { + return $this->concern; + } + + /** + * {@inheritdoc} + */ + public function apply(base $appbox, Application $app) + { + $auth = $app['phraseanet.configuration']['authentication']; + + if (!isset($auth['captcha'])) { + return true; + } + + if (isset($auth['captcha']['trials-before-failure'])) { + $auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure']; + unset($auth['captcha']['trials-before-failure']); + } + + $app['phraseanet.configuration']['authentication'] = $auth; + + return true; + } +} diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index c9f1f0159a..86031392aa 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -89,7 +89,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index 55b4553acd..d2aec2af26 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -72,7 +72,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index 55b4553acd..d2aec2af26 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -72,7 +72,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml index 85d4fe3e4a..8e96612e6f 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml @@ -97,7 +97,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml index 42f4b2f2ba..d759922465 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml @@ -97,7 +97,7 @@ authentication: templates: { } captcha: enabled: true - trials-before-failure: 9 + trials-before-display: 9 providers: facebook: enabled: false diff --git a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php index fad55d5360..6814d4732a 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php @@ -88,7 +88,7 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase $app->register(new ConfigurationServiceProvider()); $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); - $conf['authentication']['captcha']['trials-before-failure'] = 42; + $conf['authentication']['captcha']['trials-before-display'] = 42; $app['phraseanet.configuration'] = $conf; $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') diff --git a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php index 5cd45faf89..3343bff54d 100644 --- a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php +++ b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php @@ -208,7 +208,7 @@ class Migration38Test extends AbstractSetupTester ), 'captcha' => array( 'enabled' => true, - 'trials-before-failure' => 9, + 'trials-before-display' => 9, ), 'providers' => array( 'facebook' => array( From c1347618ac6990373b5391fdb578c526ff7d5382 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:02:29 +0200 Subject: [PATCH 04/10] Fix #1240 : Remove authentication>auto-create>enabled parameter --- config/configuration.sample.yml | 1 - .../AuthenticationManagerServiceProvider.php | 4 +++- lib/classes/patch/3817.php | 10 +++++----- lib/conf.d/configuration.yml | 1 - .../Fixtures/configuration-setup.yml | 9 +++------ .../Configuration/Fixtures/configuration.yml | 9 +++------ .../Fixtures/configuration-debugger.yml | 1 - .../Fixtures/configuration-maintenance.yml | 1 - ...uthenticationManagerServiceProviderTest.php | 18 ++++++++---------- .../Version/Migration/Migration38Test.php | 1 - 10 files changed, 22 insertions(+), 33 deletions(-) diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index c638e5270f..3931c98b71 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -82,7 +82,6 @@ border-manager: mediatypes: [Audio, Document, Flash, Image, Video] authentication: auto-create: - enabled: false templates: { } captcha: enabled: true diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php index 6e5a74b454..9648ec7304 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php @@ -67,8 +67,10 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface } }, $authConf['auto-create']['templates'])); + + $enabled = $app['phraseanet.registry']->get('GV_autoregister') && $app['registration.enabled']; - return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $authConf['auto-create']['enabled'], $templates); + return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $enabled, $templates); }); $app['authentication.providers'] = $app->share(function (Application $app) { diff --git a/lib/classes/patch/3817.php b/lib/classes/patch/3817.php index 9a6571690f..5a9ea516b9 100644 --- a/lib/classes/patch/3817.php +++ b/lib/classes/patch/3817.php @@ -50,15 +50,15 @@ class patch_3817 implements patchInterface { $auth = $app['phraseanet.configuration']['authentication']; - if (!isset($auth['captcha'])) { - return true; - } - - if (isset($auth['captcha']['trials-before-failure'])) { + if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) { $auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure']; unset($auth['captcha']['trials-before-failure']); } + if (isset($auth['auto-create']) && isset($auth['auto-create']['enabled'])) { + unset($auth['auto-create']['enabled']); + } + $app['phraseanet.configuration']['authentication'] = $auth; return true; diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index 86031392aa..a825e3c461 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -85,7 +85,6 @@ border-manager: mediatypes: [Audio, Document, Flash, Image, Video] authentication: auto-create: - enabled: false templates: { } captcha: enabled: true diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index d2aec2af26..58c79f2194 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -68,7 +68,6 @@ border-manager: mediatypes: [Audio, Document, Flash, Image, Video] authentication: auto-create: - enabled: false templates: { } captcha: enabled: true @@ -116,8 +115,6 @@ registration-fields: required: true xsendfile: enabled: false - type: '' - mapping: - - - directory: '' - mount-point: '' + type: nginx + mapping: [] +plugins: [] diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index d2aec2af26..58c79f2194 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -68,7 +68,6 @@ border-manager: mediatypes: [Audio, Document, Flash, Image, Video] authentication: auto-create: - enabled: false templates: { } captcha: enabled: true @@ -116,8 +115,6 @@ registration-fields: required: true xsendfile: enabled: false - type: '' - mapping: - - - directory: '' - mount-point: '' + type: nginx + mapping: [] +plugins: [] diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml index 8e96612e6f..cc2a01a159 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml @@ -93,7 +93,6 @@ border-manager: - Video authentication: auto-create: - enabled: false templates: { } captcha: enabled: true diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml index d759922465..777037aa2b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml @@ -93,7 +93,6 @@ border-manager: - Video authentication: auto-create: - enabled: false templates: { } captcha: enabled: true diff --git a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php index 6814d4732a..af9dd08ef3 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php @@ -107,12 +107,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase $app = new PhraseaApplication(); $app->register(new ConfigurationServiceProvider()); - $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); + $conf = $app['phraseanet.configuration']->getConfig(); $conf['authentication']['auto-create'] = array( - 'enabled' => true, 'templates' => array(), ); - $app['phraseanet.configuration'] = $conf; + $app['phraseanet.configuration']->setConfig($conf); $app['authentication.providers.account-creator']; } @@ -139,11 +138,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase })); $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; - $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); + $conf = $app['phraseanet.configuration']->getConfig(); $conf['authentication']['captcha'] = array( 'enabled' => true, ); - $app['phraseanet.configuration'] = $conf; + $app['phraseanet.configuration']->setConfig($conf); $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') ->disableOriginalConstructor() @@ -177,11 +176,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase })); $app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox']; - $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); + $conf = $app['phraseanet.configuration']->getConfig(); $conf['authentication']['captcha'] = array( 'enabled' => false, ); - $app['phraseanet.configuration'] = $conf; + $app['phraseanet.configuration']->setConfig($conf); $app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager') ->disableOriginalConstructor() @@ -203,15 +202,14 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase $template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false); $template2->set_template(self::$DI['user']); - $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig(); + $conf = $app['phraseanet.configuration']->getConfig(); $conf['authentication']['auto-create'] = array( - 'enabled' => true, 'templates' => array( $template1->get_id(), $template2->get_login() ) ); - $app['phraseanet.configuration'] = $conf; + $app['phraseanet.configuration']->setConfig($conf); $this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates()); diff --git a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php index 3343bff54d..f9f7ce4e7d 100644 --- a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php +++ b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php @@ -202,7 +202,6 @@ class Migration38Test extends AbstractSetupTester ), 'authentication' => array( 'auto-create' => array( - 'enabled' => false, 'templates' => array( ), ), From ca7501f9c100cb62ff3524a652d4a7431e8bb759 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:23:41 +0200 Subject: [PATCH 05/10] Hide passwords in bin/setup system:install command --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index a78efc0a4c..983549fa2f 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -126,7 +126,7 @@ class Install extends Command $hostname = $dialog->ask($output, "DB hostname (localhost) : ", 'localhost'); $port = $dialog->ask($output, "DB port (3306) : ", 3306); $dbUser = $dialog->ask($output, "DB user : "); - $dbPassword = $dialog->ask($output, "DB password : "); + $dbPassword = $dialog->askHiddenResponse($output, "DB password (hidden) : "); $abName = $dialog->ask($output, "DB name (phraseanet) : ", 'phraseanet'); try { @@ -192,7 +192,7 @@ class Install extends Command } while (!\Swift_Validate::email($email)); do { - $password = $dialog->ask($output, 'Please provide a password (6 character min) : '); + $password = $dialog->askHiddenResponse($output, 'Please provide a password (hidden, 6 character min) : '); } while (strlen($password) < 6); $output->writeln("\n\tEmail / Password successfully set\n"); From 4265ee3feaf518579d9e2dd550466fcdd6fbee5a Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:24:09 +0200 Subject: [PATCH 06/10] Initialize $template value --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 983549fa2f..e8a872803c 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -148,7 +148,7 @@ class Install extends Command { $credentials = $abConn->get_credentials(); - $dbConn = null; + $dbConn = $template = null; if (!$input->getOption('databox')) { do { $retry = false; From 45c938cf24eb45c2d1b169747f6b7e15d338db9b Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:24:42 +0200 Subject: [PATCH 07/10] Initialize date fields value --- lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php index 6b808b9a0f..c65d891bbf 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php @@ -61,6 +61,7 @@ class PhraseaEngine implements SearchEngineInterface public function getAvailableDateFields() { if (!$this->dateFields) { + $this->dateFields = array(); foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) { foreach ($databox->get_meta_structure() as $databox_field) { if ($databox_field->get_type() != \databox_field::TYPE_DATE) { From 20621f40403eb218592ea735e02a462b4264d66c Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:27:00 +0200 Subject: [PATCH 08/10] Add more precision for available template languages --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index e8a872803c..bcb15e5d47 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -37,7 +37,7 @@ class Install extends Command ->addOption('db-port', null, InputOption::VALUE_OPTIONAL, 'MySQL server port', 3306) ->addOption('db-user', null, InputOption::VALUE_OPTIONAL, 'MySQL server user', 'phrasea') ->addOption('db-password', null, InputOption::VALUE_OPTIONAL, 'MySQL server password', null) - ->addOption('db-template', null, InputOption::VALUE_OPTIONAL, 'Metadata structure language template', null) + ->addOption('db-template', null, InputOption::VALUE_OPTIONAL, 'Metadata structure language template (available are fr (french) and en (english))', null) ->addOption('databox', null, InputOption::VALUE_OPTIONAL, 'Database name for the DataBox', null) ->addOption('appbox', null, InputOption::VALUE_OPTIONAL, 'Database name for the ApplicationBox', null) ->addOption('indexer', null, InputOption::VALUE_OPTIONAL, 'Path to Phraseanet Indexer', 'auto') @@ -160,7 +160,7 @@ class Install extends Command $output->writeln("\n\tData-Box : Connection successful !\n"); do { - $template = $dialog->ask($output, 'Choose a language template for metadata structure (en) : ', 'en'); + $template = $dialog->ask($output, 'Choose a language template for metadata structure, available are fr (french) and en (english) (en) : ', 'en'); } while (!in_array($template, array('en', 'fr'))); $output->writeln("\n\tLanguage selected is '$template'\n"); From 541150b699f7b70cd5c7d6ade305edd74576c2c1 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:36:25 +0200 Subject: [PATCH 09/10] Remove unused file --- www/include/geonames.feedback.php | 32 ------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 www/include/geonames.feedback.php diff --git a/www/include/geonames.feedback.php b/www/include/geonames.feedback.php deleted file mode 100644 index 0fde0336a2..0000000000 --- a/www/include/geonames.feedback.php +++ /dev/null @@ -1,32 +0,0 @@ -get_parms('action', 'city'); - -$action = $parm['action']; - -switch ($action) { - case 'FIND': - $output = $app['twig']->render('geonames/city_list.html.twig', array('geonames' => $app['geonames']->find_city($parm['city']))); - break; -} - - -echo $output; - From 2d8e53bef27856a7836c112e3adedcd8eccd8397 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Wed, 10 Jul 2013 14:36:48 +0200 Subject: [PATCH 10/10] Reload tree after databox unmount --- lib/Alchemy/Phrasea/Controller/Admin/Databox.php | 4 +--- lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php | 1 + templates/web/admin/databases.html.twig | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php index ab345baa0c..fb02a9dac9 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php @@ -854,9 +854,7 @@ class Databox implements ControllerProviderInterface )); } - return $app->redirectPath('admin_database', array( - 'databox_id' => $databox_id, - 'error' => 'file-too-big', + return $app->redirectPath('admin_databases', array( 'reload-tree' => 1, )); } diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php index 8fef608c36..3b1f93a861 100644 --- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php +++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php @@ -186,6 +186,7 @@ class Databoxes implements ControllerProviderInterface 'error_msg' => $errorMsg, 'recommendations' => $upgrader->getRecommendations(), 'advices' => $request->query->get('advices', array()), + 'reloadTree' => (Boolean) $request->query->get('reload-tree'), )); } diff --git a/templates/web/admin/databases.html.twig b/templates/web/admin/databases.html.twig index a00dbde5b6..b6b5fe1945 100644 --- a/templates/web/admin/databases.html.twig +++ b/templates/web/admin/databases.html.twig @@ -1,3 +1,9 @@ +{% if reloadTree %} + +{% endif %} + {% if app['request'].query.get('success') == '1' %}
×