This commit is contained in:
2021-03-18 18:50:04 +08:00
parent 4705613884
commit 2bd515a44d
+7 -8
View File
@@ -41,13 +41,6 @@ class ServerInotify extends Process
public function onHandler(\Swoole\Process $process): void public function onHandler(\Swoole\Process $process): void
{ {
set_error_handler([$this, 'onErrorHandler']); set_error_handler([$this, 'onErrorHandler']);
if (env('debug') != 'true') {
Timer::tick(100000, function () {
});
return;
}
$this->dirs = Config::get('inotify', false, [APP_PATH]); $this->dirs = Config::get('inotify', false, [APP_PATH]);
if (extension_loaded('inotify')) { if (extension_loaded('inotify')) {
$this->inotify = inotify_init(); $this->inotify = inotify_init();
@@ -72,7 +65,10 @@ class ServerInotify extends Process
private function loadDirs($isReload = false) private function loadDirs($isReload = false)
{ {
foreach ($this->dirs as $value) { foreach ($this->dirs as $value) {
$this->loadByDir(realpath($value), $isReload); if (is_bool($path = realpath($value))) {
continue;
}
$this->loadByDir($path, $isReload);
} }
} }
@@ -103,6 +99,9 @@ class ServerInotify extends Process
*/ */
private function loadByDir($path, $isReload = false): void private function loadByDir($path, $isReload = false): void
{ {
if (!is_string($path)) {
return;
}
$path = rtrim($path, '/'); $path = rtrim($path, '/');
foreach (glob(realpath($path) . '/*') as $value) { foreach (glob(realpath($path) . '/*') as $value) {
if (is_dir($value)) { if (is_dir($value)) {