* user: move the checkTmp method from model.php to zen.php bacause it's only used in zen.php.
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
+26
-1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user