Fix install.lock not always saved

This commit is contained in:
Laurent Destailleur 2018-01-28 10:57:01 +01:00
parent 2f28240ce4
commit 97c2828d04

View File

@ -345,7 +345,8 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i',$action))
// Create lock file
// If first install
if ($action == "set" && $success) {
if ($action == "set" && $success)
{
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ($conf->global->MAIN_VERSION_LAST_UPGRADE == DOL_VERSION))
{
// Install is finished
@ -353,14 +354,14 @@ if ($action == "set" && $success) {
$createlock=0;
if (! empty($force_install_lockinstall))
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Install is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if ($force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));
@ -403,14 +404,14 @@ elseif (empty($action) || preg_match('/upgrade/i',$action))
$createlock=0;
if (! empty($force_install_lockinstall))
if (! empty($force_install_lockinstall) || ! empty($conf->global->MAIN_ALWAYS_CREATE_LOCK_AFTER_LAST_UPGRADE))
{
// Upgrade is finished, we create the lock file
$lockfile=DOL_DATA_ROOT.'/install.lock';
$fp = @fopen($lockfile, "w");
if ($fp)
{
if ($force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
if (empty($force_install_lockinstall) || $force_install_lockinstall == 1) $force_install_lockinstall=444; // For backward compatibility
fwrite($fp, "This is a lock file to prevent use of install pages (set with permission ".$force_install_lockinstall.")");
fclose($fp);
@chmod($lockfile, octdec($force_install_lockinstall));