-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathclient
More file actions
50 lines (44 loc) · 1.89 KB
/
client
File metadata and controls
50 lines (44 loc) · 1.89 KB
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
42
43
44
45
46
47
48
49
50
<?php
#!/usr/bin/php
/*
--------------------------------------------------------
Встроенный помощник для работы сайта, по
типу artisan в Laravel.
Author: Mr.666dd
--------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| Подключение конфигурации приложения и обработчика аргументов
|--------------------------------------------------------------------------
*/
$db = require "config/database.php";
require "vendor/client/handler.php";
$infoHandler = require "config/handler.client.php";
if($infoHandler['work'] != 'true') die("Error: Helper ".$infoHandler['name']." off in config.\n");
if(!isset($argv[1])) die("Error: command is not specified\n");
$command = strtolower($argv[1]);
if(!in_array($command, $infoHandler['commands'])){
die("Error: command is not found\n");
} for($i = 0; $i < count($infoHandler['commands']); $i++){
if(array_search($command, $infoHandler['commands'], true) == $i){
$command = $infoHandler['commands'][$i];
$handler = new ClientCommandHandler($db['host'], $db['user'], $db['password'], $db['db']['client']);
if($command == 'up'){
$handler->UpApp();
} else if($command == 'down'){
$handler->DownApp();
} else if($command == 'status'){
if($handler->CheckApp() == 1) echo "Application is down\n"; elseif($handler->CheckApp() == 0) echo "Application is up\n"; else echo "Error: Check: Return unknown int\n";
} else if($command == 'info'){
printf("\nName: %s or %s\n", $infoHandler['name'], $argv[0]);
printf("Version: %s\n", $infoHandler['version']);
printf("Description: %s\n", $infoHandler['description']);
printf("Author: %s\n", $infoHandler['author']);
printf("Commands: ");
foreach($infoHandler['commands'] as $commandsHandler){
printf("\n%s", $commandsHandler);
}
}
}
}