kevin tessier 5 gadi atpakaļ
vecāks
revīzija
287a7ccd0c

+ 7 - 0
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
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
README.md


+ 1 - 1
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', '/');
 

+ 24 - 0
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;
+        }
+    }
 }

+ 1 - 1
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();

+ 25 - 0
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');
+        }
+    }
 }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels