forked from BobCoderS9/SSPanel-Metron
-
Notifications
You must be signed in to change notification settings - Fork 15
/
xcat
55 lines (48 loc) · 1.27 KB
/
xcat
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
51
52
53
54
55
#!/usr/bin/env php
<?php
//declare(strict_types=1);
use App\Services\Boot;
require __DIR__ . '/app/predefine.php';
require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/config/.config.php';
require __DIR__ . '/app/envload.php';
require __DIR__ . '/config/.metron_setting.php';
Boot::setTime();
Boot::bootDb();
if (!isset($argv[1])) {
$commandPath = BASE_PATH . '/src/Command/';
$allCommandFiles = glob($commandPath . '*.php');
$allCommands = str_replace(
[
$commandPath,
'.php'
],
[
'\\App\\Command\\',
''
],
$allCommandFiles
);
echo PHP_EOL;
foreach ($allCommands as $commandClass) {
if ($commandClass == '\\App\\Command\\Command') {
continue;
}
if (!class_exists($commandClass)) {
continue;
}
$triggerObject = new $commandClass($argv);
if (!property_exists($triggerObject, 'description')) {
continue;
}
echo $triggerObject->description . PHP_EOL;
}
return;
}
$classPath = '\\App\\Command\\' . $argv[1];
if (class_exists($classPath)) {
$trigger = new $classPath($argv);
$trigger->boot();
} else {
echo 'Unable to load class: ' . $classPath . PHP_EOL;
}