XBackBone/bin/clean

29 lines
575 B
Plaintext
Raw Normal View History

2018-04-28 12:20:07 +00:00
#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
2018-04-28 12:20:07 +00:00
if (php_sapi_name() !== 'cli') {
die();
}
$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);