// Small backend optimization

This commit is contained in:
Damien Metzger
2013-07-23 09:50:26 +02:00
parent 4b6642d76c
commit 91c5d184b6
2 changed files with 21 additions and 12 deletions
+9 -6
View File
@@ -244,12 +244,15 @@ class EmployeeCore extends ObjectModel
*/
public function isLoggedBack()
{
/* Employee is valid only if it can be load and if cookie password is the same as database one */
return ($this->id
&& Validate::isUnsignedId($this->id)
&& Employee::checkPassword($this->id, $this->passwd)
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
);
if (!Cache::isStored('isLoggedBack'.$this->id))
{
/* Employee is valid only if it can be load and if cookie password is the same as database one */
Cache::store('isLoggedBack'.$this->id, (
$this->id && Validate::isUnsignedId($this->id) && Employee::checkPassword($this->id, $this->passwd)
&& (!isset($this->remote_addr) || $this->remote_addr == ip2long(Tools::getRemoteAddr()) || !Configuration::get('PS_COOKIE_CHECKIP'))
));
}
return Cache::retrieve('isLoggedBack'.$this->id);
}
/**