Better advice for installer
This commit is contained in:
parent
f03d940050
commit
2569805b05
@ -50,9 +50,11 @@ print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("VersionLastInstall")."</td><td>".$conf->global->MAIN_VERSION_LAST_INSTALL."</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("VersionProgram")."</td><td>".DOL_VERSION."</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("VersionLastUpgrade")."</td><td>".$conf->global->MAIN_VERSION_LAST_UPGRADE;
|
||||
print "</td></tr>\n";
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var]."><td width=\"300\">".$langs->trans("VersionProgram")."</td><td>".DOL_VERSION;
|
||||
// If current version differs from last upgrade
|
||||
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
|
||||
print "</td></tr>\n";
|
||||
print '</table>';
|
||||
|
||||
@ -246,40 +246,12 @@ else
|
||||
$allowinstall=1;
|
||||
}
|
||||
print "<br />\n";
|
||||
print "<br />\n";
|
||||
|
||||
// Si prerequis ok, on affiche le bouton pour passer à l'étape suivante
|
||||
if ($checksok)
|
||||
{
|
||||
$ok=0;
|
||||
|
||||
print $langs->trans("ChooseYourSetupMode");
|
||||
|
||||
print '<table width="100%" cellspacing="1" cellpadding="4" border="1">';
|
||||
|
||||
print '<tr><td nowrap="nowrap"><b>'.$langs->trans("FreshInstall").'</b></td><td>';
|
||||
print $langs->trans("FreshInstallDesc").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($allowinstall)
|
||||
{
|
||||
print '<a href="licence.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("InstallNotAllowed");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
$migrationscript=array(array('from'=>'2.0.0', 'to'=>'2.1.0'),
|
||||
array('from'=>'2.1.0', 'to'=>'2.2.0'),
|
||||
array('from'=>'2.2.0', 'to'=>'2.4.0'),
|
||||
array('from'=>'2.4.0', 'to'=>'2.5.0'),
|
||||
array('from'=>'2.5.0', 'to'=>'2.6.0'),
|
||||
array('from'=>'2.6.0', 'to'=>'2.7.0')
|
||||
);
|
||||
|
||||
|
||||
// Try to create db connexion
|
||||
if (file_exists($conffile))
|
||||
{
|
||||
@ -303,7 +275,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# If a database access is available, we set more variable
|
||||
if ($ok)
|
||||
{
|
||||
@ -315,11 +286,53 @@ else
|
||||
$conf->setValues($db);
|
||||
// Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE
|
||||
// Version to install is DOL_VERSION
|
||||
$dolibarrcurrentversionarray=split('[\.-]',$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
$dolibarrlastupgradeversionarray=split('[\.-]',$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
$dolibarrversiontoinstallarray=versiondolibarrarray();
|
||||
}
|
||||
|
||||
# Show title
|
||||
if (! empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
|
||||
{
|
||||
print $langs->trans("VersionLastUpgrade").": ".$conf->global->MAIN_VERSION_LAST_UPGRADE.'<br>';
|
||||
print $langs->trans("VersionProgram").": ".DOL_VERSION;
|
||||
//print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired"));
|
||||
print '<br>';
|
||||
print '<br>';
|
||||
}
|
||||
else print "<br />\n";
|
||||
|
||||
print $langs->trans("ChooseYourSetupMode");
|
||||
|
||||
print '<table width="100%" cellspacing="1" cellpadding="4" border="1">';
|
||||
|
||||
|
||||
# Sho first install line
|
||||
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("FreshInstall").'</b></td>';
|
||||
print '<td>';
|
||||
print $langs->trans("FreshInstallDesc").'</td>';
|
||||
print '<td align="center">';
|
||||
if ($allowinstall)
|
||||
{
|
||||
print '<a href="licence.php?selectlang='.$setuplang.'">'.$langs->trans("Start").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print $langs->trans("InstallNotAllowed");
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
|
||||
# Show upgrade lines
|
||||
$allowupgrade=true;
|
||||
$migrationscript=array( //array('from'=>'2.0.0', 'to'=>'2.1.0'),
|
||||
//array('from'=>'2.1.0', 'to'=>'2.2.0'),
|
||||
array('from'=>'2.2.0', 'to'=>'2.4.0'),
|
||||
array('from'=>'2.4.0', 'to'=>'2.5.0'),
|
||||
array('from'=>'2.5.0', 'to'=>'2.6.0'),
|
||||
array('from'=>'2.6.0', 'to'=>'2.7.0')
|
||||
);
|
||||
|
||||
$foundrecommandedchoice=0;
|
||||
foreach ($migrationscript as $migarray)
|
||||
{
|
||||
@ -327,19 +340,29 @@ else
|
||||
$versionto=$migarray['to'];
|
||||
$newversionfrom=eregi_replace('\.[0-9]+$','.*',$versionfrom);
|
||||
$newversionto=eregi_replace('\.[0-9]+$','.*',$versionto);
|
||||
print '<tr><td nowrap="nowrap"><b>'.$langs->trans("Upgrade").' '.$newversionfrom.' -> '.$newversionto.'</b></td>';
|
||||
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>';
|
||||
print '<td>';
|
||||
print $langs->trans("UpgradeDesc");
|
||||
if ($ok && sizeof($dolibarrcurrentversionarray) > 0) // If a database access is available and a version already available
|
||||
if ($ok)
|
||||
{
|
||||
$dolibarrversionfromarray=split('[\.-]',$versionfrom);
|
||||
$dolibarrversiontoarray=split('[\.-]',$versionto);
|
||||
if (empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrcurrentversionarray) >= 0)
|
||||
if (sizeof($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available
|
||||
{
|
||||
print '<br>';
|
||||
print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
// <img src="../theme/eldy/img/tick.png" alt="Ok"> ';
|
||||
$foundrecommandedchoice=1; // To show only once
|
||||
$dolibarrversionfromarray=split('[\.-]',$versionfrom);
|
||||
$dolibarrversiontoarray=split('[\.-]',$versionto);
|
||||
// If last upgrade was an alpha or beta, we increase target version to 1 to select this one.
|
||||
if (isset($conf->global->MAIN_VERSION_LAST_UPGRADE) && eregi('beta|alpha',$conf->global->MAIN_VERSION_LAST_UPGRADE)) $dolibarrversiontoarray[2]=(isset($dolibarrversiontoarray[2]) ? ($dolibarrversiontoarray[2]+1) : 1);
|
||||
// Now we check if this is the first qualified choice
|
||||
if (empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0)
|
||||
{
|
||||
print '<br>';
|
||||
//print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE);
|
||||
print '<center><div class="warning">'.$langs->trans("InstallChoiceSuggested").'</div></center>';
|
||||
// <img src="../theme/eldy/img/tick.png" alt="Ok"> ';
|
||||
$foundrecommandedchoice=1; // To show only once
|
||||
}
|
||||
}
|
||||
else {
|
||||
// We can not recommand a choice.
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
@ -129,6 +129,7 @@ FieldRenamed=Field renamed
|
||||
IfLoginDoesNotExistsCheckCreateUser=If login does not exists yet, you must check option "Create user"
|
||||
ErrorConnection=Server "<b>%s</b>", database name "<b>%s</b>", login "<b>%s</b>", or database password may be wrong or PHP client version may be too old compared to database version.
|
||||
InstallChoiceRecommanded=Recommanded choice to install version <b>%s</b> from your current version <b>%s</b>
|
||||
InstallChoiceSuggested=<b>Install choice suggested by installer</b>.
|
||||
|
||||
#########
|
||||
# upgrade
|
||||
|
||||
@ -129,6 +129,7 @@ FieldRenamed=Champ renommé
|
||||
IfLoginDoesNotExistsCheckCreateUser=Si le login n'existe pas encore, vous devez cocher l'option "Créer l'utilisateur"
|
||||
ErrorConnection=Le serveur "<b>%s</b>", nom de base "<b>%s</b>", login "<b>%s</b>", ou mot de passe de la base de donnée est peut-être incorrect ou la version du client PHP trop ancienne par rapport à la version de la base de donnée.
|
||||
InstallChoiceRecommanded=Choix recommandé pour installer la version <b>%s</b> depuis votre version actuelle <b>%s</b>
|
||||
InstallChoiceSuggested=<b>Choix suggéré par l'installeur</b>.
|
||||
|
||||
#########
|
||||
# upgrade
|
||||
|
||||
@ -40,22 +40,24 @@ function versiontostring($versionarray)
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Compare 2 versions
|
||||
\param versionarray1 Tableau de version (vermajeur,vermineur,autre)
|
||||
\param versionarray2 Tableau de version (vermajeur,vermineur,autre)
|
||||
\return int <0 si versionarray1<versionarray2, 0 si =, >0 si versionarray1>versionarray2
|
||||
* \brief Compare 2 versions
|
||||
* \param versionarray1 Array of version (vermajor,verminor,patch)
|
||||
* \param versionarray2 Array of version (vermajor,verminor,patch)
|
||||
* \return int -3,-2,-1 if versionarray1<versionarray2 (value depends on level of difference)
|
||||
* 0 if =
|
||||
* 1,2,3 if versionarray1>versionarray2 (value depends on level of difference)
|
||||
*/
|
||||
function versioncompare($versionarray1,$versionarray2)
|
||||
{
|
||||
$ret=0;
|
||||
$i=0;
|
||||
while ($i < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
$level=0;
|
||||
while ($level < max(sizeof($versionarray1),sizeof($versionarray1)))
|
||||
{
|
||||
$operande1=isset($versionarray1[$i])?$versionarray1[$i]:0;
|
||||
$operande2=isset($versionarray2[$i])?$versionarray2[$i]:0;
|
||||
if ($operande1 < $operande2) { $ret = -1; break; }
|
||||
if ($operande1 > $operande2) { $ret = 1; break; }
|
||||
$i++;
|
||||
$operande1=isset($versionarray1[$level])?$versionarray1[$level]:0;
|
||||
$operande2=isset($versionarray2[$level])?$versionarray2[$level]:0;
|
||||
$level++;
|
||||
if ($operande1 < $operande2) { $ret = -$level; break; }
|
||||
if ($operande1 > $operande2) { $ret = $level; break; }
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
@ -217,7 +219,7 @@ function run_sql($sqlfile,$silent=1)
|
||||
$newsql=str_replace($from,$to,$newsql);
|
||||
dol_syslog('Admin.lib::run_sql New Request '.($i+1).' sql='.$newsql, LOG_DEBUG);
|
||||
}
|
||||
|
||||
|
||||
// Replace __ENTITY__ with current entity id
|
||||
while (eregi('(__ENTITY__)',$newsql,$reg))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user