mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Refactor GridFieldSubsiteDetailForm_ItemRequest and $_cache_accessible_sites
Remove underscores to comply with PSR-2
This commit is contained in:
parent
8b5f593999
commit
098660e27d
@ -6,5 +6,5 @@ use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
|||||||
|
|
||||||
class GridFieldSubsiteDetailForm extends GridFieldDetailForm
|
class GridFieldSubsiteDetailForm extends GridFieldDetailForm
|
||||||
{
|
{
|
||||||
protected $itemRequestClass = GridFieldSubsiteDetailForm_ItemRequest::class;
|
protected $itemRequestClass = GridFieldSubsiteDetailFormItemRequest::class;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use SilverStripe\Forms\Form;
|
|||||||
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
|
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
|
||||||
use SilverStripe\Subsites\Model\Subsite;
|
use SilverStripe\Subsites\Model\Subsite;
|
||||||
|
|
||||||
class GridFieldSubsiteDetailForm_ItemRequest extends GridFieldDetailForm_ItemRequest
|
class GridFieldSubsiteDetailFormItemRequest extends GridFieldDetailForm_ItemRequest
|
||||||
{
|
{
|
||||||
|
|
||||||
private static $allowed_actions = [
|
private static $allowed_actions = [
|
@ -74,14 +74,14 @@ class Subsite extends DataObject
|
|||||||
*
|
*
|
||||||
* @array
|
* @array
|
||||||
*/
|
*/
|
||||||
private static $_cache_accessible_sites = [];
|
protected static $cache_accessible_sites = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory cache of subsite id for domains
|
* Memory cache of subsite id for domains
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $_cache_subsite_for_domain = [];
|
protected static $cache_subsite_for_domain = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Numeric array of all themes which are allowed to be selected for all subsites.
|
* Numeric array of all themes which are allowed to be selected for all subsites.
|
||||||
@ -268,8 +268,8 @@ class Subsite extends DataObject
|
|||||||
|
|
||||||
$currentUserId = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0;
|
$currentUserId = Security::getCurrentUser() ? Security::getCurrentUser()->ID : 0;
|
||||||
$cacheKey = implode('_', [$host, $currentUserId, static::config()->get('check_is_public')]);
|
$cacheKey = implode('_', [$host, $currentUserId, static::config()->get('check_is_public')]);
|
||||||
if (isset(self::$_cache_subsite_for_domain[$cacheKey])) {
|
if (isset(self::$cache_subsite_for_domain[$cacheKey])) {
|
||||||
return self::$_cache_subsite_for_domain[$cacheKey];
|
return self::$cache_subsite_for_domain[$cacheKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
$SQL_host = Convert::raw2sql($host);
|
$SQL_host = Convert::raw2sql($host);
|
||||||
@ -319,7 +319,7 @@ class Subsite extends DataObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($cacheKey) {
|
if ($cacheKey) {
|
||||||
self::$_cache_subsite_for_domain[$cacheKey] = $subsiteID;
|
self::$cache_subsite_for_domain[$cacheKey] = $subsiteID;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $subsiteID;
|
return $subsiteID;
|
||||||
@ -355,8 +355,8 @@ class Subsite extends DataObject
|
|||||||
*/
|
*/
|
||||||
public static function on_db_reset()
|
public static function on_db_reset()
|
||||||
{
|
{
|
||||||
self::$_cache_accessible_sites = [];
|
self::$cache_accessible_sites = [];
|
||||||
self::$_cache_subsite_for_domain = [];
|
self::$cache_subsite_for_domain = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -462,8 +462,8 @@ class Subsite extends DataObject
|
|||||||
|
|
||||||
// Cache handling
|
// Cache handling
|
||||||
$cacheKey = $SQL_codes . '-' . $member->ID . '-' . $includeMainSite . '-' . $mainSiteTitle;
|
$cacheKey = $SQL_codes . '-' . $member->ID . '-' . $includeMainSite . '-' . $mainSiteTitle;
|
||||||
if (isset(self::$_cache_accessible_sites[$cacheKey])) {
|
if (isset(self::$cache_accessible_sites[$cacheKey])) {
|
||||||
return self::$_cache_accessible_sites[$cacheKey];
|
return self::$cache_accessible_sites[$cacheKey];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @skipUpgrade */
|
/** @skipUpgrade */
|
||||||
@ -539,7 +539,7 @@ class Subsite extends DataObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$_cache_accessible_sites[$cacheKey] = $subsites;
|
self::$cache_accessible_sites[$cacheKey] = $subsites;
|
||||||
|
|
||||||
return $subsites;
|
return $subsites;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user