modify mysql result
This commit is contained in:
+5
-6
@@ -51,16 +51,15 @@ class Inotify extends BaseProcess
|
|||||||
set_exception_handler([$this, 'error']);
|
set_exception_handler([$this, 'error']);
|
||||||
|
|
||||||
if (!extension_loaded('inotify')) {
|
if (!extension_loaded('inotify')) {
|
||||||
Timer::tick(1000, function ($cid) {
|
while (true) {
|
||||||
if ($this->isStop()) {
|
if ($this->isStop()) {
|
||||||
Timer::clear($cid);
|
break;
|
||||||
}
|
}
|
||||||
});
|
sleep(1);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$this->dirs = Config::get('reload.inotify', []);
|
||||||
$this->dirs = Config::get('inotify', []);
|
|
||||||
|
|
||||||
$this->start();
|
$this->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+54
-54
@@ -24,67 +24,67 @@ class ServerCommand extends Command
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
const ACTIONS = ['start', 'stop', 'restart'];
|
const ACTIONS = ['start', 'stop', 'restart'];
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
protected function configure()
|
protected function configure()
|
||||||
{
|
{
|
||||||
$this->setName('sw:server')
|
$this->setName('sw:server')
|
||||||
->setDescription('server start|stop|reload|restart')
|
->setDescription('server start|stop|reload|restart')
|
||||||
->addArgument('action', InputArgument::OPTIONAL, 'run action', 'start')
|
->addArgument('action', InputArgument::OPTIONAL, 'run action', 'start')
|
||||||
->addOption('daemon', 'd', InputOption::VALUE_OPTIONAL, 'is run daemonize');
|
->addOption('daemon', 'd', InputOption::VALUE_OPTIONAL, 'is run daemonize');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param InputInterface $input
|
* @param InputInterface $input
|
||||||
* @param OutputInterface $output
|
* @param OutputInterface $output
|
||||||
* @return int
|
* @return int
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
* @throws ContainerExceptionInterface
|
* @throws ContainerExceptionInterface
|
||||||
* @throws NotFoundExceptionInterface
|
* @throws NotFoundExceptionInterface
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function execute(InputInterface $input, OutputInterface $output): int
|
public function execute(InputInterface $input, OutputInterface $output): int
|
||||||
{
|
{
|
||||||
$manager = Kiri::app()->getServer();
|
$manager = Kiri::app()->getServer();
|
||||||
$manager->setDaemon((int)!is_null($input->getOption('daemon')));
|
$manager->setDaemon((int)!is_null($input->getOption('daemon')));
|
||||||
|
|
||||||
$this->scan_file();
|
$this->scan_file();
|
||||||
|
|
||||||
$action = $input->getArgument('action');
|
$action = $input->getArgument('action');
|
||||||
if (is_null($action)) {
|
if (is_null($action)) {
|
||||||
throw new Exception('I don\'t know what I want to do.');
|
throw new Exception('I don\'t know what I want to do.');
|
||||||
}
|
}
|
||||||
if (!in_array($action, self::ACTIONS)) {
|
if (!in_array($action, self::ACTIONS)) {
|
||||||
throw new Exception('I don\'t know what I want to do.');
|
throw new Exception('I don\'t know what I want to do.');
|
||||||
}
|
}
|
||||||
if ($action == 'restart' || $action == 'stop') {
|
if ($action == 'restart' || $action == 'stop') {
|
||||||
$manager->shutdown();
|
$manager->shutdown();
|
||||||
if ($action == 'stop') {
|
if ($action == 'stop') {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$manager->start();
|
$manager->start();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function scan_file()
|
protected function scan_file(): void
|
||||||
{
|
{
|
||||||
$config = Config::get('scanner', []);
|
$config = Config::get('reload.scanner', []);
|
||||||
if (is_array($config)) foreach ($config as $key => $value) {
|
if (is_array($config)) foreach ($config as $key => $value) {
|
||||||
scan_directory($value, $key);
|
scan_directory($value, $key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user