Skip to content

Commit

Permalink
Increase Performance in unsetting rules in ACL
Browse files Browse the repository at this point in the history
unsetting a non-existing rule doesn't throw an error.
In our Project this change improves loading time from 55 sec to 0.5 sec
(14412 Resources, 11694 Rules)

Refs:
- Shardj/zf1-future#134
- zendframework/zend-permissions-acl#29
- zendframework/zf1#737

Signed-off-by: Elan Ruusamäe <glen@pld-linux.org>
  • Loading branch information
schrankenstein authored and glensc committed Feb 28, 2021
1 parent 3646720 commit e6cf890
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions library/Zend/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,7 @@ public function remove($resource)
public function removeAll()
{
foreach ($this->_resources as $resourceId => $resource) {
foreach ($this->_rules['byResourceId'] as $resourceIdCurrent => $rules) {
if ($resourceId === $resourceIdCurrent) {
unset($this->_rules['byResourceId'][$resourceIdCurrent]);
}
}
unset($this->_rules['byResourceId'][$resourceId]);
}

$this->_resources = array();
Expand Down

0 comments on commit e6cf890

Please sign in to comment.