mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-01 15:26:12 +00:00
Add script to clear css cache.
This commit is contained in:
parent
fd8244d193
commit
a143b014a2
40
backend/clear_cache.php
Normal file
40
backend/clear_cache.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Clear cache css cache.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function deleteDirectory($dir)
|
||||||
|
{
|
||||||
|
if (!file_exists($dir)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_dir($dir)) {
|
||||||
|
return unlink($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = scandir($dir);
|
||||||
|
foreach ($items as $item) {
|
||||||
|
if ($item === '.' || $item === '..') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = $dir . DIRECTORY_SEPARATOR . $item;
|
||||||
|
if (is_dir($path)) {
|
||||||
|
deleteDirectory($path);
|
||||||
|
} else if('.gitignore' !== $item && '.htaccess' !== $item) {
|
||||||
|
unlink($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rmdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
$path = '../tmp/auto_merge_css_js/css/';
|
||||||
|
if (deleteDirectory($path)) {
|
||||||
|
echo "Cache deleted successfully.";
|
||||||
|
} else {
|
||||||
|
echo "Error deleting cache.";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user