fix: 修复初始化安装时清理缓存报错的问题

修改aapanel 安装文档增加inotify 扩展说明
修改webman.php 自动检测是否安装inotify扩展,如果安装则自动拉取热重载监控
This commit is contained in:
xboard 2024-05-29 00:56:00 +08:00
parent fd52795f49
commit 7246eb6ebc
3 changed files with 32 additions and 29 deletions

View File

@ -188,7 +188,7 @@ class XboardInstall extends Command
$this->saveToEnv($envConfig); $this->saveToEnv($envConfig);
$this->call('config:cache'); $this->call('config:cache');
$this->call('cache:clear'); \Artisan::call('cache:clear');
$this->info('正在导入数据库请稍等...'); $this->info('正在导入数据库请稍等...');
\Artisan::call("migrate", ['--force' => true]); \Artisan::call("migrate", ['--force' => true]);
$this->info(\Artisan::output()); $this->info(\Artisan::output());

View File

@ -23,7 +23,7 @@ URL=https://www.aapanel.com/script/install_6.0_en.sh && if [ -f /usr/bin/curl ];
- swoole4 - swoole4
- readline - readline
- event - event
- inotify - inotify (可选,热重载依赖)
4. 解除被禁止函数 4. 解除被禁止函数
> aaPanel 面板 > App Store > 找到PHP 8.1点击Setting > Disabled functions 将以下函数从列表中删除 > aaPanel 面板 > App Store > 找到PHP 8.1点击Setting > Disabled functions 将以下函数从列表中删除

View File

@ -23,14 +23,15 @@ $http_worker->onMessage = static function ($connection, $request) {
} }
}; };
$worker = new Worker(); if (extension_loaded('inotify')) {
$worker->name = 'FileMonitor'; $worker = new Worker();
$worker->reloadable = false; $worker->name = 'FileMonitor';
$monitor_dirs = ['app', 'bootstrap', 'config', 'resources', 'routes', 'public', '.env']; $worker->reloadable = false;
$monitor_files = array(); $monitor_dirs = ['app', 'bootstrap', 'config', 'resources', 'routes', 'public', '.env'];
$monitor_files = array();
// 进程启动后创建inotify监控句柄 // 进程启动后创建inotify监控句柄
$worker->onWorkerStart = function ($worker) { $worker->onWorkerStart = function ($worker) {
if (!extension_loaded('inotify')) { if (!extension_loaded('inotify')) {
echo "FileMonitor : Please install inotify extension.\n"; echo "FileMonitor : Please install inotify extension.\n";
return; return;
@ -53,7 +54,9 @@ $worker->onWorkerStart = function ($worker) {
} }
} }
Worker::$globalEvent->add($worker->inotifyFd, EventInterface::EV_READ, 'check_files_change'); Worker::$globalEvent->add($worker->inotifyFd, EventInterface::EV_READ, 'check_files_change');
}; };
}
function addInofity(string $realpath, $fd) function addInofity(string $realpath, $fd)
{ {
global $monitor_files; global $monitor_files;