From: Sebastien SAUVAGE Date: Mon, 4 Mar 2013 20:26:06 +0000 (+0100) Subject: Added second check to write rights. X-Git-Tag: v0.0.41beta~2 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=979d6334e75568fd92222ccfd6c9a3f943916d71;p=github%2Fshaarli%2FShaarli.git Added second check to write rights. (Because on some hosts is_writable() is not reliable.) --- diff --git a/index.php b/index.php index 7b2781f1..1babe952 100644 --- a/index.php +++ b/index.php @@ -82,6 +82,8 @@ if (!is_writable(realpath(dirname(__FILE__)))) die('
ERROR: Shaarli does not
 if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
 if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files.
 if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
+// Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable.
+if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('
ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').
'); if ($GLOBALS['config']['ENABLE_LOCALCACHE']) { if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); }