Check that Shaarli has the right to write in its own directory.

Because some user forget to check this at installation.
This commit is contained in:
Sebastien SAUVAGE 2013-03-04 21:14:07 +01:00
parent 8a80e4fe07
commit f2cb5f95a9

View file

@ -78,6 +78,7 @@ function stripslashes_deep($value) { $value = is_array($value) ? array_map('stri
header("Pragma: no-cache");
// Directories creations (Note that your web host may require differents rights than 705.)
if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
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.