This commit is contained in:
wangjinlei
2024-07-17 09:23:45 +08:00
parent edf9deeb1a
commit 881ac3e056
1001 changed files with 41032 additions and 5452 deletions

View File

@@ -211,6 +211,12 @@ class Lang
}
}
if (preg_match('/^([a-z\d\-]+)/i', $langSet, $matches)) {
$langSet = strtolower($matches[1]);
} else {
$langSet = self::$range;
}
// 合法的语言
if (empty(self::$allowLangList) || in_array($langSet, self::$allowLangList)) {
self::$range = $langSet ?: self::$range;

View File

@@ -70,7 +70,7 @@ class Redis extends Driver
*/
public function has($name)
{
return $this->handler->exists($this->getCacheKey($name));
return (bool) $this->handler->exists($this->getCacheKey($name));
}
/**

View File

@@ -1038,10 +1038,6 @@ class Query
return $this;
}
public function close(){
return $this->connection->close();
}
/**
* 指定OR查询条件
* @access public
@@ -1956,7 +1952,7 @@ class Query
if (!empty($this->pk)) {
$pk = $this->pk;
} else {
$pk = $this->getTableInfo(is_array($options) ? $options['table'] : $options, 'pk');
$pk = $this->getTableInfo(is_array($options) && isset($options['table']) ? $options['table'] : $options, 'pk');
}
return $pk;
}

View File

@@ -85,13 +85,11 @@ class File
*/
protected function getMasterLogFile()
{
$cli = PHP_SAPI == 'cli' ? '_cli' : '';
if ($this->config['single']) {
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$destination = $this->config['path'] . $name . '.log';
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$destination = $this->config['path'] . $name . $cli . '.log';
} else {
$cli = PHP_SAPI == 'cli' ? '_cli' : '';
if ($this->config['max_files']) {
$filename = date('Ymd') . $cli . '.log';
$files = glob($this->config['path'] . '*.log');
@@ -125,15 +123,13 @@ class File
if ($this->config['single']) {
$name = is_string($this->config['single']) ? $this->config['single'] : 'single';
$name .= '_' . $type;
} elseif ($this->config['max_files']) {
$name = date('Ymd') . '_' . $type . $cli;
$name = date('Ymd');
} else {
$name = date('d') . '_' . $type . $cli;
$name = date('d');
}
return $path . DIRECTORY_SEPARATOR . $name . '.log';
return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log';
}
/**
@@ -154,7 +150,13 @@ class File
$info['timestamp'] = date($this->config['time_format']);
foreach ($message as $type => $msg) {
$info[$type] = is_array($msg) ? implode("\r\n", $msg) : $msg;
$msg = is_array($msg) ? implode("\r\n", $msg) : $msg;
if (PHP_SAPI == 'cli') {
$info['msg'] = $msg;
$info['type'] = $type;
} else {
$info[$type] = $msg;
}
}
if (PHP_SAPI == 'cli') {

View File

@@ -196,7 +196,7 @@ class Windows extends Pipes
return;
}
if (null !== $w && 0 < count($r)) {
if (null !== $r && 0 < count($r)) {
$data = '';
while ($dataread = fread($r['input'], self::CHUNK_SIZE)) {
$data .= $dataread;