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()
|
'locale' => Session_Handler::get_locale()
|
||||||
, 'upgrade_status' => $upgrade_status
|
, 'upgrade_status' => $upgrade_status
|
||||||
, 'available_locales' => $app['available_languages']
|
, 'available_locales' => $app['available_languages']
|
||||||
|
, 'bad_users' => User_Adapter::get_wrong_email_users(appbox::get_instance())
|
||||||
, 'version_number' => GV_version
|
, 'version_number' => GV_version
|
||||||
, 'version_name' => GV_version_name)
|
, '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())
|
if (self::lock_exists())
|
||||||
throw new Exception_Setup_UpgradeAlreadyStarted();
|
throw new Exception_Setup_UpgradeAlreadyStarted();
|
||||||
$this->appbox = $appbox;
|
$this->appbox = $appbox;
|
||||||
|
|
||||||
|
if(count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
||||||
|
{
|
||||||
|
throw new Exception_Setup_FixBadEmailAddresses();
|
||||||
|
}
|
||||||
|
|
||||||
$this->write_lock();
|
$this->write_lock();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -59,6 +59,12 @@ class module_console_systemUpgrade extends Command
|
|||||||
{
|
{
|
||||||
$output->write('<info>Upgrading...</info>', true);
|
$output->write('<info>Upgrading...</info>', true);
|
||||||
$appbox = appbox::get_instance();
|
$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);
|
$upgrader = new Setup_Upgrade($appbox);
|
||||||
$advices = $appbox->forceUpgrade($upgrader);
|
$advices = $appbox->forceUpgrade($upgrader);
|
||||||
}
|
}
|
||||||
|
@@ -40,7 +40,6 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
console.log('hello update_button');
|
|
||||||
$('.update_button').bind('click', function(){
|
$('.update_button').bind('click', function(){
|
||||||
$(this).attr('disabled','disbaled');
|
$(this).attr('disabled','disbaled');
|
||||||
$('.upgrade_loader').show();
|
$('.upgrade_loader').show();
|
||||||
@@ -70,24 +69,36 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if not upgrade_status.active %}
|
{% if not upgrade_status.active %}
|
||||||
<p>
|
{% if bad_users|length > 0 %}
|
||||||
{% 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>
|
{% trans 'Before any upgrade, you have to fix your database.' %}
|
||||||
<p>
|
{% trans 'Some users have the same email address. You can fix this problem with this script :' %}
|
||||||
<code>
|
</p>
|
||||||
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/upgrade.php
|
<p>
|
||||||
</code>
|
<code style="width:90%">
|
||||||
</p>
|
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/console system:mailCheck
|
||||||
<p>
|
</code>
|
||||||
{% trans 'Si toutefois vous n\'aviez pas acces à la console, suivez le lien suivant' %}
|
</p>
|
||||||
</p>
|
{% else %}
|
||||||
<p>
|
<p>
|
||||||
<form action="/setup/upgrader/execute/" method="POST" target="update_target">
|
{% trans 'Une mise a jour de l\'application est necessaire, il est vivement recommande de l\'effectuer en ligne de commande via la commande :' %}
|
||||||
<button class="update_button">{% trans 'Mise a jour' %}</button>
|
</p>
|
||||||
<img style="display:none;" class="upgrade_loader" src="/skins/icons/loader111111.gif"/>
|
<p>
|
||||||
</form>
|
<code style="width:90%">
|
||||||
<iframe style="display:none;" src="about:blank" name="update_target"></iframe>
|
{{registry.get('GV_cli')}} {% if registry.get('GV_PHP_INI') %} -c {{registry.get('GV_PHP_INI')}}{% endif %} bin/console system:upgrade
|
||||||
</p>
|
</code>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{% trans 'Si toutefois vous n\'aviez pas acces à la console, suivez le lien suivant' %}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<form action="/setup/upgrader/execute/" method="POST" target="update_target">
|
||||||
|
<button class="update_button">{% trans 'Mise a jour' %}</button>
|
||||||
|
<img style="display:none;" class="upgrade_loader" src="/skins/icons/loader111111.gif"/>
|
||||||
|
</form>
|
||||||
|
<iframe style="display:none;" src="about:blank" name="update_target"></iframe>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>{% trans 'Progression de la mise a jour : ' %}</p>
|
<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;">
|
<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