mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
ENHANCEMENT: Be more specific about when the permission cache is flushed, so that the CMS can be more efficient. (from r83435)
This commit is contained in:
parent
53d51e40ba
commit
6d1b3901df
@ -219,7 +219,7 @@ JS;
|
|||||||
$id = Session::get('SubsiteID');
|
$id = Session::get('SubsiteID');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($id) || $id === NULL) {
|
if($id === NULL) {
|
||||||
$id = self::getSubsiteIDForDomain();
|
$id = self::getSubsiteIDForDomain();
|
||||||
Session::set('SubsiteID', $id);
|
Session::set('SubsiteID', $id);
|
||||||
}
|
}
|
||||||
@ -248,10 +248,12 @@ JS;
|
|||||||
if(is_object($subsite)) $subsiteID = $subsite->ID;
|
if(is_object($subsite)) $subsiteID = $subsite->ID;
|
||||||
else $subsiteID = $subsite;
|
else $subsiteID = $subsite;
|
||||||
|
|
||||||
Session::set('SubsiteID', $subsiteID);
|
Session::set('SubsiteID', (int)$subsiteID);
|
||||||
|
|
||||||
// And clear caches
|
// Only bother flushing caches if we've actually changed
|
||||||
Permission::flush_permission_cache() ;
|
if($subsiteID != self::currentSubsiteID()) {
|
||||||
|
Permission::flush_permission_cache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,6 +293,9 @@ JS;
|
|||||||
if(sizeof($subsiteIDs) > 1) user_error("Multiple subsites match '$host'", E_USER_WARNING);
|
if(sizeof($subsiteIDs) > 1) user_error("Multiple subsites match '$host'", E_USER_WARNING);
|
||||||
return $subsiteIDs[0];
|
return $subsiteIDs[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default subsite id = 0, the main site
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMembersByPermission($permissionCodes = array('ADMIN')){
|
function getMembersByPermission($permissionCodes = array('ADMIN')){
|
||||||
|
Loading…
Reference in New Issue
Block a user