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');
|
||||
}
|
||||
|
||||
if(!isset($id) || $id === NULL) {
|
||||
if($id === NULL) {
|
||||
$id = self::getSubsiteIDForDomain();
|
||||
Session::set('SubsiteID', $id);
|
||||
}
|
||||
@ -247,11 +247,13 @@ JS;
|
||||
static function changeSubsite($subsite) {
|
||||
if(is_object($subsite)) $subsiteID = $subsite->ID;
|
||||
else $subsiteID = $subsite;
|
||||
|
||||
Session::set('SubsiteID', $subsiteID);
|
||||
|
||||
// And clear caches
|
||||
Permission::flush_permission_cache() ;
|
||||
|
||||
Session::set('SubsiteID', (int)$subsiteID);
|
||||
|
||||
// Only bother flushing caches if we've actually changed
|
||||
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);
|
||||
return $subsiteIDs[0];
|
||||
}
|
||||
|
||||
// Default subsite id = 0, the main site
|
||||
return 0;
|
||||
}
|
||||
|
||||
function getMembersByPermission($permissionCodes = array('ADMIN')){
|
||||
|
Loading…
Reference in New Issue
Block a user