diff --git a/module/user/model.php b/module/user/model.php index 7247f8f36e..02f3ed5b52 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -1626,31 +1626,6 @@ class userModel extends model return 0; } - /** - * 检查缓存目录是否有写权限。 - * Check if the tmp directory is writable. - * - * @access public - * @return bool - */ - public function checkTmp(): bool - { - if(!is_dir($this->app->tmpRoot)) mkdir($this->app->tmpRoot, 0755, true); - if(!is_dir($this->app->cacheRoot)) mkdir($this->app->cacheRoot, 0755, true); - if(!is_dir($this->app->logRoot)) mkdir($this->app->logRoot, 0755, true); - if(!is_dir($this->app->logRoot)) return false; - - $file = $this->app->logRoot . DS . 'demo.txt'; - if($fp = @fopen($file, 'a+')) - { - @fclose($fp); - @unlink($file); - return true; - } - - return false; - } - /** * Compute user view. * diff --git a/module/user/zen.php b/module/user/zen.php index 983855d0e0..ab318207fd 100644 --- a/module/user/zen.php +++ b/module/user/zen.php @@ -11,7 +11,7 @@ class userZen extends user public function checkDirPermission(): void { $canModifyDIR = true; - if($this->user->checkTmp() === false) + if($this->checkTmp() === false) { $canModifyDIR = false; $folderPath = $this->app->tmpRoot; @@ -33,6 +33,31 @@ class userZen extends user } } + /** + * 检查缓存目录是否有写权限。 + * Check if the tmp directory is writable. + * + * @access public + * @return bool + */ + public function checkTmp(): bool + { + if(!is_dir($this->app->tmpRoot)) mkdir($this->app->tmpRoot, 0755, true); + if(!is_dir($this->app->cacheRoot)) mkdir($this->app->cacheRoot, 0755, true); + if(!is_dir($this->app->logRoot)) mkdir($this->app->logRoot, 0755, true); + if(!is_dir($this->app->logRoot)) return false; + + $file = $this->app->logRoot . DS . 'demo.txt'; + if($fp = @fopen($file, 'a+')) + { + @fclose($fp); + @unlink($file); + return true; + } + + return false; + } + /** * 获取一个用户用于 json 格式返回给前台。 * Get a user for json format to return to the front end.