改名
This commit is contained in:
@@ -63,16 +63,17 @@ class ServerInotify extends Process
|
|||||||
{
|
{
|
||||||
$this->debug('file modify listener.');
|
$this->debug('file modify listener.');
|
||||||
|
|
||||||
$this->loadByDir(APP_PATH . 'app');
|
$this->loadByDir(APP_PATH . 'app', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $path
|
* @param $path
|
||||||
|
* @param bool $isReload
|
||||||
* @return void
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function loadByDir($path)
|
private function loadByDir($path, $isReload = false)
|
||||||
{
|
{
|
||||||
$path = rtrim($path, '/');
|
$path = rtrim($path, '/');
|
||||||
foreach (glob($path . '/*') as $value) {
|
foreach (glob($path . '/*') as $value) {
|
||||||
@@ -82,15 +83,19 @@ class ServerInotify extends Process
|
|||||||
}
|
}
|
||||||
$md5 = md5($value);
|
$md5 = md5($value);
|
||||||
if (!isset($this->md5Map[$md5])) {
|
if (!isset($this->md5Map[$md5])) {
|
||||||
$this->debug('not hav ' . $value);
|
if ($isReload) {
|
||||||
return $this->reload();
|
return $this->reload();
|
||||||
}
|
}
|
||||||
|
$this->md5Map[$md5] = filectime($value);
|
||||||
|
} else {
|
||||||
$mTime = filectime($value);
|
$mTime = filectime($value);
|
||||||
if ($this->md5Map[$md5] != $mTime) {
|
if ($this->md5Map[$md5] != $mTime) {
|
||||||
$this->debug('not hav ' . $this->md5Map[$md5] . ':' . $mTime);
|
if ($isReload) {
|
||||||
return $this->reload();
|
return $this->reload();
|
||||||
}
|
}
|
||||||
$this->md5Map[$md5] = $mTime;
|
$this->md5Map[$md5] = filectime($value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user