From 1624fbfe5d05b364606ad813b4b7a51faf35b26b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sun, 14 Feb 2010 23:29:12 +0000 Subject: [PATCH] Fix: Creation of lock file if no permission on disk --- htdocs/install/etape5.php | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/htdocs/install/etape5.php b/htdocs/install/etape5.php index 3849f39ae35..98d779cff51 100644 --- a/htdocs/install/etape5.php +++ b/htdocs/install/etape5.php @@ -278,11 +278,10 @@ if ($_POST["action"] == "set") { // Install is finished print $langs->trans("SystemIsInstalled")."<br>"; - if (empty($force_install_lockinstall)) - { - print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; - } - else + + $createlock=0; + + if (! empty($force_install_lockinstall)) { // Install is finished, we create the lock file $lockfile="../../install.lock"; @@ -292,8 +291,13 @@ if ($_POST["action"] == "set") fwrite($fp, "This is a lock file to prevent use of install pages"); fclose($fp); @chmod($lockfile, octdec(444)); + $createlock=1; } } + if (empty($createlock)) + { + print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; + } print "<br>"; @@ -323,16 +327,25 @@ elseif (preg_match('/upgrade/i',$_POST["action"])) { // Upgrade is finished print $langs->trans("SystemIsUpgraded")."<br>"; - if (empty($force_install_lockinstall)) + + $createlock=0; + + if (! empty($force_install_lockinstall)) { - print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; + // Upgrade is finished, we create the lock file + $lockfile="../../install.lock"; + $fp = @fopen($lockfile, "w"); + if ($fp) + { + fwrite($fp, "This is a lock file to prevent use of install pages"); + fclose($fp); + @chmod($lockfile, octdec(444)); + $createlock=1; + } } - else + if (empty($createlock)) { - // Upgrade is finished, we create the lock file - $fp = fopen("../../install.lock", "w"); - fwrite($fp, "This is a lock file to prevent use of install pages"); - fclose($fp); + print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>"; } print "<br>"; -- GitLab