/** * recalculate security sets marked as updated in db * @param boolean $onlyForUserId specific user or all if false * @return void */ public static function calculateUpdatedSecuritySets($onlyForUserId = false) { if (Cache::get('calculatingSecuritySets', false)) { return; } //set a flag to avoid double call to this function Cache::set('calculatingSecuritySets', true); DB\startTransaction(); $res = DB\dbQuery('SELECT id FROM tree_acl_security_sets WHERE updated = 1'); while ($r = $res->fetch_assoc()) { //calculate for all even if there are sets for non existing obejcts try { Security::updateSecuritySet($r['id'], $onlyForUserId); } catch (\Exception $e) { } } $res->close(); DB\commitTransaction(); Cache::remove('calculatingSecuritySets'); }
/** * recalculate security sets marked as updated in db * @param boolean $onlyForUserId specific user or all if false * @return void */ public static function calculateUpdatedSecuritySets($onlyForUserId = false) { if (!empty($_SESSION['calculatingSecuritySets'])) { return; } //set a flag to avoid double call to this function $_SESSION['calculatingSecuritySets'] = true; DB\startTransaction(); $res = DB\dbQuery('SELECT id FROM tree_acl_security_sets WHERE updated = 1') or die(DB\dbQueryError()); while ($r = $res->fetch_assoc()) { //calculate for all even if there are sets for non existing obejcts try { Security::updateSecuritySet($r['id'], $onlyForUserId); } catch (\Exception $e) { } } $res->close(); DB\commitTransaction(); unset($_SESSION['calculatingSecuritySets']); }