update kirby to v5 and add refresh cache panel view button
This commit is contained in:
commit
9a86d41254
466 changed files with 19960 additions and 10497 deletions
|
|
@ -112,7 +112,7 @@ class Environment
|
|||
|
||||
/**
|
||||
* Returns the server's IP address
|
||||
* @see ::ip
|
||||
* @see self::ip()
|
||||
*/
|
||||
public function address(): string|null
|
||||
{
|
||||
|
|
@ -156,13 +156,13 @@ class Environment
|
|||
array|null $options = null,
|
||||
array|null $info = null
|
||||
): array {
|
||||
$defaults = [
|
||||
$options = [
|
||||
'cli' => null,
|
||||
'allowed' => null
|
||||
'allowed' => null,
|
||||
...$options ?? []
|
||||
];
|
||||
|
||||
$info ??= $_SERVER;
|
||||
$options = array_merge($defaults, $options ?? []);
|
||||
$info ??= $_SERVER;
|
||||
|
||||
$this->info = static::sanitize($info);
|
||||
$this->cli = $this->detectCli($options['cli']);
|
||||
|
|
@ -178,11 +178,11 @@ class Environment
|
|||
if ($options['allowed'] === '*' || $options['allowed'] === ['*']) {
|
||||
$this->detectAuto(true);
|
||||
|
||||
// fixed environments
|
||||
// fixed environments
|
||||
} elseif (empty($options['allowed']) === false) {
|
||||
$this->detectAllowed($options['allowed']);
|
||||
|
||||
// secure auto-detection
|
||||
// secure auto-detection
|
||||
} else {
|
||||
$this->detectAuto();
|
||||
}
|
||||
|
|
@ -211,7 +211,9 @@ class Environment
|
|||
$baseUrl = A::first($allowed);
|
||||
|
||||
if (is_string($baseUrl) === false) {
|
||||
throw new InvalidArgumentException('Invalid allow list setup for base URLs');
|
||||
throw new InvalidArgumentException(
|
||||
message: 'Invalid allow list setup for base URLs'
|
||||
);
|
||||
}
|
||||
|
||||
$uri = new Uri($baseUrl, ['slash' => false]);
|
||||
|
|
@ -248,7 +250,9 @@ class Environment
|
|||
}
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('The environment is not allowed');
|
||||
throw new InvalidArgumentException(
|
||||
message: 'The environment is not allowed'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -330,7 +334,7 @@ class Environment
|
|||
$term = getenv('TERM');
|
||||
|
||||
if (
|
||||
substr($sapi, 0, 3) === 'cgi' &&
|
||||
str_starts_with($sapi, 'cgi') === true &&
|
||||
$term &&
|
||||
$term !== 'unknown'
|
||||
) {
|
||||
|
|
@ -529,7 +533,7 @@ class Environment
|
|||
|
||||
$protocols = ['https', 'https, http'];
|
||||
|
||||
return in_array(strtolower($protocol), $protocols) === true;
|
||||
return in_array(strtolower($protocol), $protocols, true) === true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -634,13 +638,13 @@ class Environment
|
|||
/**
|
||||
* Gets a value from the server environment array
|
||||
*
|
||||
* <code>
|
||||
* $server->get('document_root');
|
||||
* ```php
|
||||
* // sample output: /var/www/kirby
|
||||
* $server->get('document_root');
|
||||
*
|
||||
* $server->get();
|
||||
* // returns the whole server array
|
||||
* </code>
|
||||
* $server->get();
|
||||
* ```
|
||||
*
|
||||
* @param string|false|null $key The key to look for. Pass `false` or `null`
|
||||
* to return the entire server array.
|
||||
|
|
@ -771,13 +775,13 @@ class Environment
|
|||
$ips = array_unique(array_filter($ips));
|
||||
|
||||
// no known ip? Better not assume it's local
|
||||
if (empty($ips) === true) {
|
||||
if ($ips === []) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// stop as soon as a non-local ip is found
|
||||
foreach ($ips as $ip) {
|
||||
if (in_array($ip, ['::1', '127.0.0.1']) === false) {
|
||||
if (in_array($ip, ['::1', '127.0.0.1'], true) === false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -810,18 +814,24 @@ class Environment
|
|||
}
|
||||
|
||||
// load the config for the host
|
||||
if (empty($host) === false) {
|
||||
if (
|
||||
empty($host) === false &&
|
||||
F::exists($path = $root . '/config.' . $host . '.php', $root) === true
|
||||
) {
|
||||
$configHost = F::load(
|
||||
file: $root . '/config.' . $host . '.php',
|
||||
file: $path,
|
||||
fallback: [],
|
||||
allowOutput: false
|
||||
);
|
||||
}
|
||||
|
||||
// load the config for the server IP
|
||||
if (empty($addr) === false) {
|
||||
if (
|
||||
empty($addr) === false &&
|
||||
F::exists($path = $root . '/config.' . $addr . '.php', $root) === true
|
||||
) {
|
||||
$configAddr = F::load(
|
||||
file: $root . '/config.' . $addr . '.php',
|
||||
file: $path,
|
||||
fallback: [],
|
||||
allowOutput: false
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue