XBackBone/bin/clean

29 lines
710 B
Text
Raw Normal View History

2018-04-28 12:20:07 +00:00
#!/usr/bin/env php
<?php
2022-06-19 21:29:59 +00:00
((PHP_MAJOR_VERSION >= 7 && PHP_MINOR_VERSION >= 3) || PHP_MAJOR_VERSION > 7) ?: die('Sorry, PHP 7.3 or above is required to run XBackBone.');
2021-07-31 11:09:45 +00:00
if (PHP_SAPI !== 'cli') {
2018-04-28 12:20:07 +00:00
die();
}
require __DIR__ . '/../vendor/autoload.php';
2018-04-28 12:20:07 +00:00
$action = isset($argv[1]) ? $argv[1] : 'all';
switch ($action) {
case 'cache':
cleanDirectory(__DIR__ . '/../resources/cache');
2018-04-28 12:20:07 +00:00
break;
case 'sessions':
cleanDirectory(__DIR__ . '/../resources/sessions');
2018-04-28 12:20:07 +00:00
break;
case 'all':
cleanDirectory(__DIR__ . '/../resources/cache');
cleanDirectory(__DIR__ . '/../resources/sessions');
2018-04-28 12:20:07 +00:00
break;
case 'help':
default:
echo 'Usage: php ' . $argv[0] . ' <cache|sessions|all|help>' . PHP_EOL;
}
exit(0);