diff --git a/CHANGELOG.md b/CHANGELOG.md index 223eb8f316..a134907f4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# v1.7.40 +## 03/22/2023 + +1. [](#new) + * Added a new `timestamp: true|false` option for individual assets +1. [](#improved) + * Removed outdated `xcache` setting [#3615](https://github.com/getgrav/grav/pull/3615) + * Updated `robots.txt` [#3625](https://github.com/getgrav/grav/pull/3625) +1. [](#bugfix) + * Fixed `force_ssl` redirect in case of undefined hostname [#3702](https://github.com/getgrav/grav/pull/3702) + * Fixed an issue with duplicate identical page paths + * Fixed `BlueprintSchema:flattenData` to properly handle ignored fields + * Fixed LogViewer regex greediness [#3684](https://github.com/getgrav/grav/pull/3684) + * Fixed `whoami` command [#3695](https://github.com/getgrav/grav/pull/3695) + # v1.7.39.4 ## 02/22/2023 diff --git a/robots.txt b/robots.txt index 1d41d40ad5..cb22b6b28e 100644 --- a/robots.txt +++ b/robots.txt @@ -1,16 +1,21 @@ User-agent: * +Disallow: /.github/ +Disallow: /.phan/ +Disallow: /assets/ Disallow: /backup/ Disallow: /bin/ Disallow: /cache/ -Disallow: /grav/ Disallow: /logs/ Disallow: /system/ -Disallow: /vendor/ +Disallow: /tests/ +Disallow: /tmp/ Disallow: /user/ +Disallow: /vendor/ +Disallow: /webserver-configs/ Allow: /user/pages/ Allow: /user/themes/ Allow: /user/images/ Allow: / Allow: *.css$ Allow: *.js$ -Allow: /system/*.js$ \ No newline at end of file +Allow: /system/*.js$ diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index 09e80837d7..14fef03ce9 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -608,7 +608,6 @@ form: file: File apc: APC apcu: APCu - xcache: Xcache memcache: Memcache memcached: Memcached wincache: WinCache diff --git a/system/defines.php b/system/defines.php index 2856310923..6945cd1e7c 100644 --- a/system/defines.php +++ b/system/defines.php @@ -9,7 +9,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.7.39.4'); +define('GRAV_VERSION', '1.7.40'); define('GRAV_SCHEMA', '1.7.0_2020-11-20_1'); define('GRAV_TESTING', false); diff --git a/system/src/Grav/Common/Assets.php b/system/src/Grav/Common/Assets.php index 125a5180a7..9c270d9866 100644 --- a/system/src/Grav/Common/Assets.php +++ b/system/src/Grav/Common/Assets.php @@ -268,7 +268,13 @@ protected function addType($collection, $type, $asset, $options) } // Add timestamp - $options['timestamp'] = $this->timestamp; + $timestamp_override = $options['timestamp'] ?? true; + + if (filter_var($timestamp_override, FILTER_VALIDATE_BOOLEAN)) { + $options['timestamp'] = $this->timestamp; + } else { + $options['timestamp'] = null; + } // Set order $group = $options['group'] ?? 'head'; diff --git a/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php b/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php index e2d89814d2..d4a223b29f 100644 --- a/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php +++ b/system/src/Grav/Common/Assets/Traits/AssetUtilsTrait.php @@ -192,6 +192,7 @@ protected function renderQueryString($asset = null) $querystring = ''; $asset = $asset ?? $this->asset; + $attributes = $this->attributes; if (!empty($this->query)) { if (Utils::contains($asset, '?')) { diff --git a/system/src/Grav/Common/Data/BlueprintSchema.php b/system/src/Grav/Common/Data/BlueprintSchema.php index 137e042414..b476706052 100644 --- a/system/src/Grav/Common/Data/BlueprintSchema.php +++ b/system/src/Grav/Common/Data/BlueprintSchema.php @@ -129,7 +129,8 @@ public function flattenData(array $data, bool $includeAll = false, string $name $items = $name !== '' ? $this->getProperty($name)['fields'] ?? [] : $this->items; foreach ($items as $key => $rules) { $type = $rules['type'] ?? ''; - if (!str_starts_with($type, '_') && !str_contains($key, '*')) { + $ignore = (bool) array_filter((array)($rules['validate']['ignore'] ?? [])) ?? false; + if (!str_starts_with($type, '_') && !str_contains($key, '*') && $ignore !== true) { $list[$prefix . $key] = null; } } diff --git a/system/src/Grav/Common/Helpers/LogViewer.php b/system/src/Grav/Common/Helpers/LogViewer.php index 060e5612e2..a862fddb3e 100644 --- a/system/src/Grav/Common/Helpers/LogViewer.php +++ b/system/src/Grav/Common/Helpers/LogViewer.php @@ -21,7 +21,7 @@ class LogViewer { /** @var string */ - protected $pattern = '/\[(?P.*)\] (?P\w+).(?P\w+): (?P.*[^ ]+) (?P[^ ]+) (?P[^ ]+)/'; + protected $pattern = '/\[(?P.*?)\] (?P\w+)\.(?P\w+): (?P.*[^ ]+) (?P[^ ]+) (?P[^ ]+)/'; /** * Get the objects of a tailed file diff --git a/system/src/Grav/Common/Page/Pages.php b/system/src/Grav/Common/Page/Pages.php index 8fbcb397e0..e39e3ab60b 100644 --- a/system/src/Grav/Common/Page/Pages.php +++ b/system/src/Grav/Common/Page/Pages.php @@ -1774,7 +1774,7 @@ protected function getPagesPaths(): array $dirs = (array) $grav['config']->get('system.pages.dirs', ['page://']); foreach ($dirs as $dir) { $path = $locator->findResource($dir); - if (file_exists($path)) { + if (file_exists($path) && !in_array($path, $paths, true)) { $paths[] = $path; } } diff --git a/system/src/Grav/Common/Scheduler/Scheduler.php b/system/src/Grav/Common/Scheduler/Scheduler.php index 1a1750b637..f4cf4549cd 100644 --- a/system/src/Grav/Common/Scheduler/Scheduler.php +++ b/system/src/Grav/Common/Scheduler/Scheduler.php @@ -357,7 +357,7 @@ private function saveJobStates() */ public function whoami() { - $process = new Process('whoami'); + $process = new Process(['whoami']); $process->run(); if ($process->isSuccessful()) { diff --git a/system/src/Grav/Common/Service/PagesServiceProvider.php b/system/src/Grav/Common/Service/PagesServiceProvider.php index 52ef5eae3f..0e10d144e1 100644 --- a/system/src/Grav/Common/Service/PagesServiceProvider.php +++ b/system/src/Grav/Common/Service/PagesServiceProvider.php @@ -72,7 +72,7 @@ public function register(Container $container) if ($config->get('system.force_ssl')) { $scheme = $uri->scheme(true); if ($scheme !== 'https') { - $url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; + $url = 'https://' . $uri->host() . $uri->uri(); $grav->redirect($url); } }