From 22d94e94a2e69da9a9947a044c55cfca657c4744 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 9 Jan 2013 21:31:03 +0100 Subject: [PATCH] Fixed unnecessary cache clearing --- .../AbstractDatabaseObjectAction.class.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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() */ -- 2.20.1