aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristophe HENRY <christophe.henry@sbgodin.fr>2014-08-04 00:13:30 +0200
committerChristophe HENRY <christophe.henry@sbgodin.fr>2014-08-04 00:41:55 +0200
commite7416aba2c7a06fc96e37700f555c2b70a5ac859 (patch)
tree910796d32e5eae5253b6c126c3b6cc8676203741
parentc614a35db8c49bc953c6fcd83161def61a76d945 (diff)
downloadShaarli-e7416aba2c7a06fc96e37700f555c2b70a5ac859.tar.gz
Shaarli-e7416aba2c7a06fc96e37700f555c2b70a5ac859.tar.zst
Shaarli-e7416aba2c7a06fc96e37700f555c2b70a5ac859.zip
Adds empty directories: cache, data, pagecache and tmp. Removes mkdirs.
They are still in .gitignore because their future content will still be ignored.
-rw-r--r--cache/.placeholder0
-rw-r--r--data/.placeholder0
-rw-r--r--index.php4
-rw-r--r--pagecache/.placeholder0
-rw-r--r--tmp/.placeholder0
5 files changed, 0 insertions, 4 deletions
diff --git a/cache/.placeholder b/cache/.placeholder
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/cache/.placeholder
diff --git a/data/.placeholder b/data/.placeholder
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/data/.placeholder
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");
88 88
89// Directories creations (Note that your web host may require differents rights than 705.) 89// Directories creations (Note that your web host may require differents rights than 705.)
90if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>'); 90if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
91if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
92if (!is_dir($GLOBALS['config']['RAINTPL_TMP'])) { mkdir($GLOBALS['config']['RAINTPL_TMP'],0705);chmod($GLOBALS['config']['RAINTPL_TMP'],0705); } // For RainTPL temporary files.
93if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. 91if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
94// Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable. 92// Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable.
95if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('<pre>ERROR: Shaarli does not have the right to write in its data directory ('.realpath($GLOBALS['config']['DATADIR']).').</pre>'); 93if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('<pre>ERROR: Shaarli does not have the right to write in its data directory ('.realpath($GLOBALS['config']['DATADIR']).').</pre>');
96if ($GLOBALS['config']['ENABLE_LOCALCACHE']) 94if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
97{ 95{
98 if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); }
99 if (!is_file($GLOBALS['config']['CACHEDIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['CACHEDIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. 96 if (!is_file($GLOBALS['config']['CACHEDIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['CACHEDIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
100} 97}
101 98
@@ -188,7 +185,6 @@ class pageCache
188 public function cache($page) 185 public function cache($page)
189 { 186 {
190 if (!$this->shouldBeCached) return; 187 if (!$this->shouldBeCached) return;
191 if (!is_dir($GLOBALS['config']['PAGECACHE'])) { mkdir($GLOBALS['config']['PAGECACHE'],0705); chmod($GLOBALS['config']['PAGECACHE'],0705); }
192 file_put_contents($this->filename,$page); 188 file_put_contents($this->filename,$page);
193 } 189 }
194 190
diff --git a/pagecache/.placeholder b/pagecache/.placeholder
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/pagecache/.placeholder
diff --git a/tmp/.placeholder b/tmp/.placeholder
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tmp/.placeholder