Merge branch 'develop' of https://github.com/getgrav/grav into 1.6

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Matias Griese
2018-11-27 10:17:53 +02:00
3 changed files with 55 additions and 0 deletions

View File

@@ -107,6 +107,12 @@
* Doctrine filecache is now namespaced with prefix to support purging
* Register all page types into `blueprint://pages` stream
# v1.5.6
## mm/dd/2018
1. [](#improved)
* Improved user serialization to use less memory in the session
# v1.5.5
## 11/12/2018

View File

@@ -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;
}
}
}

View File

@@ -293,4 +293,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');
}
}
}