Introduce a protection to avoid migration if database has critical bugs
making data lost.
This commit is contained in:
parent
46b1e213b9
commit
c596fa1475
@ -201,7 +201,7 @@ abstract class DoliDB implements Database
|
||||
*/
|
||||
function getVersionArray()
|
||||
{
|
||||
return explode('.',$this->getVersion());
|
||||
return preg_split("/[\.,-]/",$this->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -531,9 +531,11 @@ $("div#AShowChoices a").click(function() {
|
||||
|
||||
});
|
||||
|
||||
/*
|
||||
$(".runupgrade").click(function() {
|
||||
return confirm("'.dol_escape_js($langs->transnoentitiesnoconv("WarningUpgrade"), 0, 1).'");
|
||||
});
|
||||
*/
|
||||
|
||||
</script>';
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ if (! $versionfrom && ! $versionto)
|
||||
$sapi_type = php_sapi_name();
|
||||
$script_file = basename(__FILE__);
|
||||
$path=dirname(__FILE__).'/';
|
||||
if (substr($sapi_type, 0, 3) == 'cli')
|
||||
if (substr($sapi_type, 0, 3) == 'cli')
|
||||
{
|
||||
print 'Syntax from command line: '.$script_file." x.y.z a.b.c\n";
|
||||
}
|
||||
@ -178,7 +178,7 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
print '<td align="right">'.$version.'</td></tr>';
|
||||
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerVersion")." : $version");
|
||||
|
||||
// Test database version
|
||||
// Test database version requirement
|
||||
$versionmindb=$db::VERSIONMIN;
|
||||
//print join('.',$versionarray).' - '.join('.',$versionmindb);
|
||||
if (count($versionmindb) && count($versionarray)
|
||||
@ -190,6 +190,32 @@ if (! GETPOST("action") || preg_match('/upgrade/i',GETPOST('action')))
|
||||
$ok=0;
|
||||
}
|
||||
|
||||
// Test database version is not forbidden for migration
|
||||
$dbversion_disallowed=array(
|
||||
array('type'=>'mysql','version'=>array(5,5,40)),
|
||||
array('type'=>'mysqli','version'=>array(5,5,40)),
|
||||
array('type'=>'mysql','version'=>array(5,5,41)),
|
||||
array('type'=>'mysqli','version'=>array(5,5,41))
|
||||
);
|
||||
$listofforbiddenversion='';
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
if ($dbversion_totest['type'] == $db->type) $listofforbiddenversion.=($listofforbiddenversion?', ':'').join('.',$dbversion_totest['version']);
|
||||
}
|
||||
foreach ($dbversion_disallowed as $dbversion_totest)
|
||||
{
|
||||
print $db->type.' - '.join('.',$versionarray).' - '.versioncompare($dbversion_totest['version'],$versionarray)."<br>\n";
|
||||
if ($dbversion_totest['type'] == $db->type
|
||||
&& (versioncompare($dbversion_totest['version'],$versionarray) == 0 || versioncompare($dbversion_totest['version'],$versionarray)<=-4 || versioncompare($dbversion_totest['version'],$versionarray)>=4)
|
||||
)
|
||||
{
|
||||
// Warning: database version too low.
|
||||
print '<tr><td><div class="warning">'.$langs->trans("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion)."</div></td><td align=\"right\">".$langs->trans("Error")."</td></tr>\n";
|
||||
dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorDatabaseVersionForbiddenForMigration",join('.',$versionarray),$listofforbiddenversion));
|
||||
$ok=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Force l'affichage de la progression
|
||||
|
||||
@ -156,6 +156,7 @@ LastStepDesc=<strong>Last step</strong>: Define here login and password you plan
|
||||
ActivateModule=Activate module %s
|
||||
ShowEditTechnicalParameters=Click here to show/edit advanced parameters (expert mode)
|
||||
WarningUpgrade=Warning:\nDid your run a database backup first ?\nThis is highly recommanded: for example, due to some bugs into databases systems (for example mysql version 5.5.40), some data or tables may be lost during this process, so it is highly recommanded to have a complete dump of your database before starting migration.\n\nClick OK to start migration process...
|
||||
ErrorDatabaseVersionForbiddenForMigration=Your database version is %s. It has a critical bug making data loss if you make structure change on your database, like it is required by the migration process. For his reason, migration will not be allowed until you upgrade your database to a higher fixed version (list of known bugged version: %s)
|
||||
|
||||
#########
|
||||
# upgrade
|
||||
|
||||
@ -3,7 +3,7 @@ Tutorial to create a new image for menu:
|
||||
|
||||
1) First find an image.
|
||||
2) With Gimp, open image and check there is a alpha channel. If not add one.
|
||||
3) Convert image into back and white.
|
||||
3) Convert image into back and white (Menu Image - Mode - Grey levels).
|
||||
4) Use the degrade tool with option:
|
||||
* Erase color
|
||||
* Opacity: 50 +/-
|
||||
|
||||
Loading…
Reference in New Issue
Block a user