-
Notifications
You must be signed in to change notification settings - Fork 0
/
avl
executable file
·42 lines (41 loc) · 1003 Bytes
/
avl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env php
<?php
function delete($directory){
$files = glob($directory);
foreach ($files as $file){
if(is_file($file)){
unlink($file);
}
}
}
$port = 8080;
if ($argc >= 2) {
$command = $argv[1];
if ($command === 'serve') {
$port = $argc >= 3 && is_int($argv[3]) ? $argv[2] : $port;
echo 'Starting AVL Framework PHP server at port ' . $port . PHP_EOL;
system("php -S localhost:{$port}");
} else {
$action = explode(':', $command);
switch ($action[0]){
case 'clear':{
switch ($action[1]){
case 'cache':{
echo 'Clearing Cache'.PHP_EOL;
delete("storage/caches/*");
delete("storage/caches/views/*");
echo 'Cache Cleared'.PHP_EOL;
break;
}
case 'session':{
echo 'Clearing Session'.PHP_EOL;
delete("storage/sessions/*");
echo 'Session Cleared'.PHP_EOL;
break;
}
}
break;
}
}
}
}