mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix upgrade with a bad databox
This commit is contained in:
@@ -49,6 +49,7 @@ class Controller_Setup_Upgrader implements ControllerProviderInterface
|
||||
'locale' => Session_Handler::get_locale()
|
||||
, 'upgrade_status' => $upgrade_status
|
||||
, 'available_locales' => $app['available_languages']
|
||||
, 'bad_users' => User_Adapter::get_wrong_email_users(appbox::get_instance())
|
||||
, 'version_number' => GV_version
|
||||
, 'version_name' => GV_version_name)
|
||||
);
|
||||
|
21
lib/classes/Exception/Setup/FixBadEmailAddresses.class.php
Normal file
21
lib/classes/Exception/Setup/FixBadEmailAddresses.class.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2010 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @package Exception
|
||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||
* @link www.phraseanet.com
|
||||
*/
|
||||
class Exception_Setup_FixBadEmailAddresses extends Exception
|
||||
{
|
||||
|
||||
}
|
@@ -54,6 +54,12 @@ class Setup_Upgrade
|
||||
if (self::lock_exists())
|
||||
throw new Exception_Setup_UpgradeAlreadyStarted();
|
||||
$this->appbox = $appbox;
|
||||
|
||||
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
||||
{
|
||||
throw new Exception_Setup_FixBadEmailAddresses();
|
||||
}
|
||||
|
||||
$this->write_lock();
|
||||
|
||||
return $this;
|
||||
|
@@ -59,6 +59,12 @@ class module_console_systemUpgrade extends Command
|
||||
{
|
||||
$output->write('<info>Upgrading...</info>', true);
|
||||
$appbox = appbox::get_instance();
|
||||
|
||||
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
||||
{
|
||||
return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>'));
|
||||
}
|
||||
|
||||
$upgrader = new Setup_Upgrade($appbox);
|
||||
$advices = $appbox->forceUpgrade($upgrader);
|
||||
}
|
||||
|
@@ -40,7 +40,6 @@
|
||||
|
||||
{% endif %}
|
||||
$(document).ready(function(){
|
||||
console.log('hello update_button');
|
||||
$('.update_button').bind('click', function(){
|
||||
$(this).attr('disabled','disbaled');
|
||||
$('.upgrade_loader').show();
|
||||
@@ -70,12 +69,23 @@
|
||||
<tr>
|
||||
<td>
|
||||
{% if not upgrade_status.active %}
|
||||
{% if bad_users|length > 0 %}
|
||||
<p>
|
||||
{% trans 'Before any upgrade, you have to fix your database.' %}
|
||||
{% trans 'Some users have the same email address. You can fix this problem with this script :' %}
|
||||
</p>
|
||||
<p>
|
||||
<code style="width:90%">
|
||||
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/console system:mailCheck
|
||||
</code>
|
||||
</p>
|
||||
{% else %}
|
||||
<p>
|
||||
{% trans 'Une mise a jour de l\'application est necessaire, il est vivement recommande de l\'effectuer en ligne de commande via la commande :' %}
|
||||
</p>
|
||||
<p>
|
||||
<code>
|
||||
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/upgrade.php
|
||||
<code style="width:90%">
|
||||
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/console system:upgrade
|
||||
</code>
|
||||
</p>
|
||||
<p>
|
||||
@@ -88,6 +98,7 @@
|
||||
</form>
|
||||
<iframe style="display:none;" src="about:blank" name="update_target"></iframe>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<p>{% trans 'Progression de la mise a jour : ' %}</p>
|
||||
<div id="progress_meter" style="text-align:center;width:100%;height:26px;border:1px solid #404040;position:relative;">
|
||||
|
Reference in New Issue
Block a user