Fix: Upgrade detection fails

This commit is contained in:
Laurent Destailleur 2011-07-12 20:48:08 +00:00
parent 530a7e3f3a
commit 68f89857b6

View File

@ -23,7 +23,7 @@
* \file htdocs/install/check.php * \file htdocs/install/check.php
* \ingroup install * \ingroup install
* \brief Test if file conf can be modified and if does not exists, test if install process can create it * \brief Test if file conf can be modified and if does not exists, test if install process can create it
* \version $Id$ * \version $Id: check.php,v 1.83 2011/07/12 20:48:08 eldy Exp $
*/ */
include_once("./inc.php"); include_once("./inc.php");
@ -385,10 +385,15 @@ else
foreach ($migrationscript as $migarray) foreach ($migrationscript as $migarray)
{ {
$count++; $count++;
$versionfrom=$migarray['from']; $versionfrom=$migarray['from'];
$versionto=$migarray['to']; $versionto=$migarray['to'];
$newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom); $newversionfrom=preg_replace('/(\.[0-9]+)$/i','.*',$versionfrom);
$newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto); $newversionto=preg_replace('/(\.[0-9]+)$/i','.*',$versionto);
$dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom);
$dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
$version=preg_split('/[\.-]/',DOL_VERSION);
$newversionfrombis='';
if (versioncompare($dolibarrversiontoarray,$version) < 2) $newversionfrombis='/'.$versionto;
print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>'; print '<tr><td nowrap="nowrap" align="center"><b>'.$langs->trans("Upgrade").'<br>'.$newversionfrom.' -> '.$newversionto.'</b></td>';
print '<td>'; print '<td>';
print $langs->trans("UpgradeDesc"); print $langs->trans("UpgradeDesc");
@ -396,8 +401,6 @@ else
{ {
if (sizeof($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available if (sizeof($dolibarrlastupgradeversionarray) >= 2) // If a database access is available and a version x.y already available
{ {
$dolibarrversionfromarray=preg_split('/[\.-]/',$versionfrom);
$dolibarrversiontoarray=preg_split('/[\.-]/',$versionto);
// Now we check if this is the first qualified choice // Now we check if this is the first qualified choice
if ($allowupgrade && empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0) if ($allowupgrade && empty($foundrecommandedchoice) && versioncompare($dolibarrversiontoarray,$dolibarrlastupgradeversionarray) > 0)
{ {