Fix: Creation of lock file if no permission on disk

This commit is contained in:
Laurent Destailleur 2010-02-14 23:29:12 +00:00
parent 598a1dc7b2
commit 1624fbfe5d

View File

@ -278,11 +278,10 @@ if ($_POST["action"] == "set")
{ {
// Install is finished // Install is finished
print $langs->trans("SystemIsInstalled")."<br>"; print $langs->trans("SystemIsInstalled")."<br>";
if (empty($force_install_lockinstall))
{ $createlock=0;
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
} if (! empty($force_install_lockinstall))
else
{ {
// Install is finished, we create the lock file // Install is finished, we create the lock file
$lockfile="../../install.lock"; $lockfile="../../install.lock";
@ -292,8 +291,13 @@ if ($_POST["action"] == "set")
fwrite($fp, "This is a lock file to prevent use of install pages"); fwrite($fp, "This is a lock file to prevent use of install pages");
fclose($fp); fclose($fp);
@chmod($lockfile, octdec(444)); @chmod($lockfile, octdec(444));
$createlock=1;
} }
} }
if (empty($createlock))
{
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
}
print "<br>"; print "<br>";
@ -323,16 +327,25 @@ elseif (preg_match('/upgrade/i',$_POST["action"]))
{ {
// Upgrade is finished // Upgrade is finished
print $langs->trans("SystemIsUpgraded")."<br>"; print $langs->trans("SystemIsUpgraded")."<br>";
if (empty($force_install_lockinstall))
{ $createlock=0;
print '<div class="warning">'.$langs->trans("WarningRemoveInstallDir")."</div>";
} if (! empty($force_install_lockinstall))
else
{ {
// Upgrade is finished, we create the lock file // Upgrade is finished, we create the lock file
$fp = fopen("../../install.lock", "w"); $lockfile="../../install.lock";
fwrite($fp, "This is a lock file to prevent use of install pages"); $fp = @fopen($lockfile, "w");
fclose($fp); if ($fp)
{
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>"; print "<br>";