Added cli.php command for purging caches
This commit is contained in:
parent
29b6186c8e
commit
b2cf09a6cd
33
cli.php
33
cli.php
|
@ -68,19 +68,52 @@ function cli__users($args) {
|
|||
echo $msg."\n";
|
||||
}
|
||||
|
||||
function cli__cache($args) {
|
||||
$help = function() {
|
||||
cli__help(false);
|
||||
echo ' cache prune|purge|delete Delete all application caches'."\n";
|
||||
die;
|
||||
};
|
||||
$msg = null;
|
||||
switch ($args[0]) {
|
||||
case 'prune':
|
||||
case 'purge':
|
||||
case 'delete':
|
||||
foreach (scandir(filedb_getdir('cache')) as $fil) {
|
||||
if (in_array($fil, ['.','..']))
|
||||
continue;
|
||||
filedb_del('cache', $fil);
|
||||
}
|
||||
$msg = 'Application cache has been succesfully purged';
|
||||
break;
|
||||
case 'help':
|
||||
default:
|
||||
$help();
|
||||
}
|
||||
if ($msg != nulL)
|
||||
echo $msg."\n";
|
||||
}
|
||||
|
||||
function cli__help($full=true) {
|
||||
echo 'APub Control cli.php 1.0 author: bofh@nogafam.es'."\n";
|
||||
echo "\n";
|
||||
echo ' Parameters:'."\n";
|
||||
if ($full === false) return;
|
||||
echo ' users <help> Add/delete/modify web application users'."\n";
|
||||
echo ' cache <help> Handle all the web application caches'."\n";
|
||||
die;
|
||||
}
|
||||
|
||||
if (count($argv) <= 1)
|
||||
cli__help();
|
||||
|
||||
switch ($argv[1]) {
|
||||
case 'users':
|
||||
cli__users(array_slice($argv, 2));
|
||||
break;
|
||||
case 'cache':
|
||||
cli__cache(array_slice($argv, 2));
|
||||
break;
|
||||
case 'help':
|
||||
cli__help();
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue