Revize 25e37f59
Přidáno uživatelem Filip Jani před téměř 6 roky(ů)
delete-cache.php | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* Slouží pro vymazání cache po deploy. |
|
5 |
*/ |
|
6 |
|
|
7 |
include 'app/bootstrap-local.php'; |
|
8 |
|
|
9 |
function deleteDir($dirPath) { |
|
10 |
if (! is_dir($dirPath)) { |
|
11 |
throw new InvalidArgumentException("$dirPath must be a directory"); |
|
12 |
} |
|
13 |
if (substr($dirPath, strlen($dirPath) - 1, 1) != '/') { |
|
14 |
$dirPath .= '/'; |
|
15 |
} |
|
16 |
$files = glob($dirPath . '*', GLOB_MARK); |
|
17 |
foreach ($files as $file) { |
|
18 |
if (is_dir($file)) { |
|
19 |
deleteDir($file); |
|
20 |
} else { |
|
21 |
unlink($file); |
|
22 |
} |
|
23 |
} |
|
24 |
rmdir($dirPath); |
|
25 |
} |
|
26 |
|
|
27 |
deleteDir($logDir); |
|
28 |
deleteDir($tempDir); |
Také k dispozici: Unified diff
Odstranění scriptu na mazání cache