From: Alexander Ebert Date: Wed, 9 Jan 2013 20:31:03 +0000 (+0100) Subject: Fixed unnecessary cache clearing X-Git-Tag: 2.0.0_Beta_1~569^2~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=22d94e94a2e69da9a9947a044c55cfca657c4744;p=GitHub%2FWoltLab%2FWCF.git Fixed unnecessary cache clearing --- diff --git a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php index 9119324b65..39c2464232 100644 --- a/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php +++ b/wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php @@ -68,6 +68,12 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID */ protected $permissionsUpdate = array(); + /** + * Resets cache if any of the listed actions is invoked + * @var array + */ + protected $resetCache = array('create', 'delete', 'toggle', 'update', 'updatePosition'); + /** * values returned by executed action * @var mixed @@ -166,8 +172,8 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID $this->returnValues = call_user_func(array($this, $this->getActionName())); // reset cache - if (ClassUtil::isInstanceOf($this->className, 'wcf\data\IEditableCachedObject')) { - call_user_func(array($this->className, 'resetCache')); + if (in_array($this->getActionName(), $this->resetCache)) { + $this->resetCache(); } // fire event action @@ -176,6 +182,15 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID return $this->getReturnValues(); } + /** + * Resets cache of database object. + */ + protected function resetCache() { + if (ClassUtil::isInstanceOf($this->className, 'wcf\data\IEditableCachedObject')) { + call_user_func(array($this->className, 'resetCache')); + } + } + /** * @see wcf\data\IDatabaseObjectAction::getActionName() */