forked from kcloze/swoole-jobs-tp5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswoole-jobs
39 lines (32 loc) · 1.15 KB
/
swoole-jobs
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
#!/usr/bin/env php
<?php
/*
* This file is part of PHP CS Fixer.
* (c) kcloze <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
// 定义项目路径
define('APP_PATH', __DIR__ . '/application/');
define('RUNTIME_PATH', __DIR__ . '/runtime/');
define('SWOOLE_JOBS_ROOT_PATH', __DIR__);
use Kcloze\Jobs\Command\AppCommand;
use Kcloze\Jobs\Command\HttpCommand;
use Symfony\Component\Console\Application;
// ThinkPHP 引导文件
require SWOOLE_JOBS_ROOT_PATH . '/thinkphp/base.php';
require SWOOLE_JOBS_ROOT_PATH . '/vendor/autoload.php';
$config = require_once SWOOLE_JOBS_ROOT_PATH . '/application/swoole-jobs.php';
$application = new Application();
$appCommand = new AppCommand($config);
$application->add($appCommand);
//check if it has http command
$option=$argv[1] ?? '';
if (isset($config['httpServer']) && $option==='http') {
$httpCommand = new HttpCommand($config);
$application->add($httpCommand);
$application->setDefaultCommand($appCommand->getName());
} else {
$application->setDefaultCommand($appCommand->getName(), true);
}
$application->run();