diff options
author | Christophe HENRY <christophe.henry@sbgodin.fr> | 2014-08-04 00:13:30 +0200 |
---|---|---|
committer | Christophe HENRY <christophe.henry@sbgodin.fr> | 2014-08-04 00:41:55 +0200 |
commit | e7416aba2c7a06fc96e37700f555c2b70a5ac859 (patch) | |
tree | 910796d32e5eae5253b6c126c3b6cc8676203741 /index.php | |
parent | c614a35db8c49bc953c6fcd83161def61a76d945 (diff) | |
download | Shaarli-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.
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 4 |
1 files changed, 0 insertions, 4 deletions
@@ -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.) |
90 | 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>'); | 90 | 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>'); |
91 | if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); } | ||
92 | if (!is_dir($GLOBALS['config']['RAINTPL_TMP'])) { mkdir($GLOBALS['config']['RAINTPL_TMP'],0705);chmod($GLOBALS['config']['RAINTPL_TMP'],0705); } // For RainTPL temporary files. | ||
93 | if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. | 91 | if (!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. |
95 | if (!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>'); | 93 | if (!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>'); |
96 | if ($GLOBALS['config']['ENABLE_LOCALCACHE']) | 94 | if ($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 | ||