- commit
- 3ca5c8d09ab1c5883ceec7e87efa95e46911ed96
- parent
- 6f7ec5e496b1eff272cc33b570f52b9430e55a5b
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2018-10-13 21:47
add mkdirp helper
Diffstat
| M | index.php | 15 | +++++++++------ |
1 files changed, 9 insertions, 6 deletions
diff --git a/index.php b/index.php
@@ -18,6 +18,13 @@ function rrmdir($path) 18 18 rmdir($path); 19 19 } 20 20 -1 21 function mkdirp($path) -1 22 { -1 23 if (!file_exists($path)) { -1 24 mkdir($path, 0777, true); -1 25 } -1 26 } -1 27 21 28 function validatePath($path) 22 29 { 23 30 if ( @@ -49,9 +56,7 @@ function getData($path, $raise=false) 49 56 50 57 function setData($path, $data) 51 58 {52 -1 if (!file_exists("../_content$path")) {53 -1 mkdir("../_content$path", 0777, true);54 -1 }-1 59 mkdirp("../_content$path"); 55 60 file_put_contents("../_content$path/index.yml", $data['yml']); 56 61 file_put_contents("../_content$path/index.md", $data['md']); 57 62 } @@ -101,9 +106,7 @@ function render($path, $verbose=false) 101 106 'date' => time(), 102 107 )); 103 108104 -1 if (!file_exists("..$path")) {105 -1 mkdir("..$path", 0777, true);106 -1 }-1 109 mkdirp("..$path"); 107 110 file_put_contents("..$path/index.html", $html); 108 111 } 109 112