FIX possibility to force install lock with GET/POST or script

This commit is contained in:
Regis Houssin 2018-12-03 13:12:42 +01:00
parent 7c46ace042
commit a2f514d4a1
2 changed files with 18 additions and 11 deletions

View File

@ -30,7 +30,7 @@ return "Regis Houssin";
# script_dolibarr_versions()
sub script_dolibarr_versions
{
return ( "7.0.0", "6.0.5", "5.0.7" );
return ( "9.0.0", "8.0.3", "7.0.4", "6.0.8", "5.0.7" );
}
sub script_dolibarr_release
@ -263,15 +263,16 @@ if ($upgrade) {
local @params = ( [ "action", "upgrade" ],
[ "versionfrom", $upgrade->{'version'} ],
[ "versionto", $ver ],
[ "installlock", "1" ],
);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory.
local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Remove the installation directory. (deprecated)
# local $dinstall = "$opts->{'dir'}/install";
# $dinstall =~ s/\/$//;
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
}
else {
@ -306,15 +307,18 @@ else {
[ "login", "admin" ],
[ "pass", $dompass ],
[ "pass_verif", $dompass ],
[ "installlock", "1" ],
);
local $p = $ver >= 3.8 ? "step5" : "etape5";
local $err = &call_dolibarr_wizard_page(\@params, $p, $d, $opts);
return (-1, "Dolibarr wizard failed : $err") if ($err);
# Remove the installation directory and protect config file.
local $dinstall = "$opts->{'dir'}/install";
$dinstall =~ s/\/$//;
$out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Remove the installation directory (deprecated)
# local $dinstall = "$opts->{'dir'}/install";
# $dinstall =~ s/\/$//;
# $out = &run_as_domain_user($d, "rm -rf ".quotemeta($dinstall));
# Protect config file
&set_permissions_as_domain_user($d, 0644, $cfile);
&set_permissions_as_domain_user($d, 0755, $cfiledir);
}
@ -386,6 +390,8 @@ sub script_dolibarr_check_latest
{
local ($ver) = @_;
local @vers = &osdn_package_versions("dolibarr",
$ver >= 9.0 ? "dolibarr\\-(9\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 8.0 ? "dolibarr\\-(8\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 7.0 ? "dolibarr\\-(7\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 6.0 ? "dolibarr\\-(6\\.0\\.[0-9\\.]+)\\.tgz" :
$ver >= 5.0 ? "dolibarr\\-(5\\.0\\.[0-9\\.]+)\\.tgz" :

View File

@ -38,6 +38,7 @@ $versionto=GETPOST("versionto",'alpha',3)?GETPOST("versionto",'alpha',3):(empty(
$setuplang=GETPOST('selectlang','aZ09',3)?GETPOST('selectlang','aZ09',3):(empty($argv[3])?'auto':$argv[3]);
$langs->setDefaultLang($setuplang);
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):(empty($argv[4])?'':$argv[4]);
$installlock=GETPOST('installlock','int')?GETPOST('installlock','int'):(empty($argv[5])?'':$argv[5]);
// Define targetversion used to update MAIN_VERSION_LAST_INSTALL for first install
// or MAIN_VERSION_LAST_UPGRADE for upgrade.
@ -362,7 +363,7 @@ if ($action == "set" && $success)
$createlock=0;
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
if (! empty($force_install_lockinstall) || ! empty($installlock) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Install is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
@ -412,7 +413,7 @@ elseif (empty($action) || preg_match('/upgrade/i',$action))
$createlock=0;
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
if (! empty($force_install_lockinstall) || ! empty($installlock) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Upgrade is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';