diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b43c8fb5..bc6af650e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# v1.5.6 +## 12/14/2018 + +1. [](#improved) + * Updated InitializeProcessor.php to use lang-safe redirect [#2268](https://github.com/getgrav/grav/pull/2268) + * Improved user serialization to use less memory in the session + # v1.5.5 ## 11/12/2018 diff --git a/README.md b/README.md index 5afbe4365..6ed3198ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ![](https://avatars1.githubusercontent.com/u/8237355?v=2&s=50) Grav -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Slack](https://grav-chat.now.sh/badge.svg)](https://chat.getgrav.org) [![Build Status](https://travis-ci.org/getgrav/grav.svg?branch=develop)](https://travis-ci.org/getgrav/grav) [![OpenCollective](https://opencollective.com/grav/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/grav/sponsors/badge.svg)](#sponsors) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad/mini.png)](https://insight.sensiolabs.com/projects/cfd20465-d0f8-4a0a-8444-467f5b5f16ad) [![Discord](https://img.shields.io/discord/501836936584101899.svg?logo=discord&colorB=728ADA&label=Discord%20Chat)](https://chat.getgrav.org) [![Build Status](https://travis-ci.org/getgrav/grav.svg?branch=develop)](https://travis-ci.org/getgrav/grav) [![OpenCollective](https://opencollective.com/grav/backers/badge.svg)](#backers) [![OpenCollective](https://opencollective.com/grav/sponsors/badge.svg)](#sponsors) Grav is a **Fast**, **Simple**, and **Flexible**, file-based Web-platform. There is **Zero** installation required. Just extract the ZIP archive, and you are already up and running. It follows similar principles to other flat-file CMS platforms, but has a different design philosophy than most. Grav comes with a powerful **Package Management System** to allow for simple installation and upgrading of plugins and themes, as well as simple updating of Grav itself. @@ -94,7 +94,7 @@ If you discover a possible security issue related to Grav or one of its plugins, * [Install](https://learn.getgrav.org/basics/installation) Grav in few seconds * Understand the [Configuration](https://learn.getgrav.org/basics/grav-configuration) * Take a peek at our available free [Skeletons](https://getgrav.org/downloads/skeletons) -* If you have questions, jump on our [Slack Room](https://getgrav.org/slack)! +* If you have questions, jump on our [Discord Chat Server](https://chat.getgrav.org)! * Have fun! # Exploring More @@ -107,71 +107,12 @@ If you discover a possible security issue related to Grav or one of its plugins, # Backers Support Grav with a monthly donation to help us continue development. [[Become a backer](https://opencollective.com/grav#backer)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # Sponsors Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/grav#sponsor)] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + # License @@ -183,7 +124,7 @@ See [LICENSE](LICENSE.txt) # Running Tests -First install the dev dependencies by running `composer update` from the Grav root. -Then `composer test` will run the Unit Tests, which should be always executed successfully on any site. -Windows users should use the `composer test-windows` command. +First install the dev dependencies by running `composer update` from the Grav root. +Then `composer test` will run the Unit Tests, which should be always executed successfully on any site. +Windows users should use the `composer test-windows` command. You can also run a single unit test file, e.g. `composer test tests/unit/Grav/Common/AssetsTest.php` diff --git a/system/defines.php b/system/defines.php index 001d88649..9357ae60b 100644 --- a/system/defines.php +++ b/system/defines.php @@ -8,7 +8,7 @@ // Some standard defines define('GRAV', true); -define('GRAV_VERSION', '1.5.5'); +define('GRAV_VERSION', '1.5.6'); define('GRAV_TESTING', false); define('DS', '/'); diff --git a/system/src/Grav/Common/File/CompiledFile.php b/system/src/Grav/Common/File/CompiledFile.php index 4da55d9eb..0fc9bb3b4 100644 --- a/system/src/Grav/Common/File/CompiledFile.php +++ b/system/src/Grav/Common/File/CompiledFile.php @@ -82,4 +82,28 @@ trait CompiledFile return parent::content($var); } + + /** + * Serialize file. + */ + public function __sleep() + { + return [ + 'filename', + 'extension', + 'raw', + 'content', + 'settings' + ]; + } + + /** + * Unserialize file. + */ + public function __wakeup() + { + if (!isset(static::$instances[$this->filename])) { + static::$instances[$this->filename] = $this; + } + } } diff --git a/system/src/Grav/Common/Processors/InitializeProcessor.php b/system/src/Grav/Common/Processors/InitializeProcessor.php index b56d0b177..6bf8cdd58 100644 --- a/system/src/Grav/Common/Processors/InitializeProcessor.php +++ b/system/src/Grav/Common/Processors/InitializeProcessor.php @@ -47,7 +47,7 @@ class InitializeProcessor extends ProcessorBase implements ProcessorInterface // Redirect pages with trailing slash if configured to do so. $path = $uri->path() ?: '/'; if ($path !== '/' && $config->get('system.pages.redirect_trailing_slash', false) && Utils::endsWith($path, '/')) { - $this->container->redirect(rtrim($path, '/')); + $this->container->redirectLangSafe(rtrim($path, '/')); } $this->container->setLocale(); diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index 438ca97a7..9cce364fd 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -286,4 +286,29 @@ class User extends Data return 'https://www.gravatar.com/avatar/' . md5($this->email); } + + /** + * Serialize user. + */ + public function __sleep() + { + return [ + 'items', + 'storage' + ]; + } + + /** + * Unserialize user. + */ + public function __wakeup() + { + $this->gettersVariable = 'items'; + $this->nestedSeparator = '.'; + + if (null === $this->blueprints) { + $blueprints = new Blueprints; + $this->blueprints = $blueprints->get('user/account'); + } + } }