From e7416aba2c7a06fc96e37700f555c2b70a5ac859 Mon Sep 17 00:00:00 2001 From: Christophe HENRY Date: Mon, 4 Aug 2014 00:13:30 +0200 Subject: [PATCH] Adds empty directories: cache, data, pagecache and tmp. Removes mkdirs. They are still in .gitignore because their future content will still be ignored. --- cache/.placeholder | 0 data/.placeholder | 0 index.php | 4 ---- pagecache/.placeholder | 0 tmp/.placeholder | 0 5 files changed, 4 deletions(-) create mode 100644 cache/.placeholder create mode 100644 data/.placeholder create mode 100644 pagecache/.placeholder create mode 100644 tmp/.placeholder diff --git a/cache/.placeholder b/cache/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/data/.placeholder b/data/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/index.php b/index.php index 3301b13c..747f113a 100644 --- a/index.php +++ b/index.php @@ -88,14 +88,11 @@ header("Pragma: no-cache"); // Directories creations (Note that your web host may require differents rights than 705.) if (!is_writable(realpath(dirname(__FILE__)))) die('
ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').
'); -if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } -if (!is_dir($GLOBALS['config']['RAINTPL_TMP'])) { mkdir($GLOBALS['config']['RAINTPL_TMP'],0705);chmod($GLOBALS['config']['RAINTPL_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 data directory ('.realpath($GLOBALS['config']['DATADIR']).').
'); if ($GLOBALS['config']['ENABLE_LOCALCACHE']) { - if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); } if (!is_file($GLOBALS['config']['CACHEDIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['CACHEDIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. } @@ -188,7 +185,6 @@ class pageCache public function cache($page) { if (!$this->shouldBeCached) return; - if (!is_dir($GLOBALS['config']['PAGECACHE'])) { mkdir($GLOBALS['config']['PAGECACHE'],0705); chmod($GLOBALS['config']['PAGECACHE'],0705); } file_put_contents($this->filename,$page); } diff --git a/pagecache/.placeholder b/pagecache/.placeholder new file mode 100644 index 00000000..e69de29b diff --git a/tmp/.placeholder b/tmp/.placeholder new file mode 100644 index 00000000..e69de29b -- 2.41.0