// Add a link to restart installer if an error occured + session protection on reinstallation

This commit is contained in:
rMalie
2012-02-03 10:43:55 +00:00
parent 2d5c22f58a
commit c04daeefc2
5 changed files with 50 additions and 3 deletions
+6
View File
@@ -45,6 +45,12 @@ class InstallSession
session_start();
}
public function clean()
{
foreach ($_SESSION as $k => $v)
unset($_SESSION[$k]);
}
public function &__get($varname)
{
if (isset($_SESSION[$varname]))
+15 -1
View File
@@ -76,6 +76,9 @@ class InstallControllerHttpProcess extends InstallControllerHttp
if (file_exists(_PS_ROOT_DIR_.'/'.self::SETTINGS_FILE))
require_once _PS_ROOT_DIR_.'/'.self::SETTINGS_FILE;
if (!$this->session->process_validated)
$this->session->process_validated = array();
if (Tools::getValue('generateSettingsFile'))
$this->processGenerateSettingsFile();
else if (Tools::getValue('installDatabase') && !empty($this->session->process_validated['generateSettingsFile']))
@@ -94,7 +97,13 @@ class InstallControllerHttpProcess extends InstallControllerHttp
{
// With no parameters, we consider that we are doing a new install, so session where the last process step
// was stored can be cleaned
$this->session->process_validated = array();
if (Tools::getValue('restart'))
$this->session->process_validated = array();
else if (!Tools::getValue('submitNext'))
{
$this->session->clean();
Tools::redirect('index.php');
}
}
}
@@ -225,6 +234,11 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->model_install->installTheme();
if ($this->model_install->getErrors())
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
// If last step is fine, we store the fact PrestaShop is installed
$this->session->last_step = 'configure';
$this->session->step = 'configure';
$this->ajaxJsonAnswer(true);
}
+1
View File
@@ -78,6 +78,7 @@ function install_error(step, errors)
current_step = 0;
is_installing = false;
$('#error_process').show();
$('#process_step_'+step.key).show().addClass('fail');
$('#progress_bar .total .progress').stop().css('width', '0px');
$('#progress_bar .installing').hide();
+23 -2
View File
@@ -693,7 +693,7 @@ ul#optional_update {list-style-type:none;}
/* STEP 5 ******************************************/
#install_process_form{
height: 260px;
min-height: 260px;
}
#progress_bar {
display: none;
@@ -763,7 +763,28 @@ ul#optional_update {list-style-type:none;}
#progress_bar ol.process_list li .error_log li {
padding: 3px;
}
#error_process{
padding: 5px;
background-color: #FBE8D6;
border: 1px solid #666666;
margin-left: 37px;
margin-bottom: 20px;
display: none;
}
#error_process h3{
color: red;
}
#error_process p{
margin-left: 20px;
}
#error_process p a{
font-weight: bold;
}
#error_process p a:hover{
text-decoration: underline;
}
#install_process_success {
display: none;
}
+5
View File
@@ -25,6 +25,11 @@ var process_percent = <?php echo 100 / count($this->process_steps) ?>;
</li>
<?php endforeach; ?>
</ol>
<div id="error_process">
<h3><?php echo $this->l('An error occured during installation ...') ?></h3>
<p><?php echo $this->l('You can use the links on the left column to go back to the previous steps, or restart the installation process by <a href="%s">clicking here</a>.', 'index.php?restart=true') ?></p>
</div>
</div>
</div>