mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Minor linting / style updates
This commit is contained in:
parent
8b429bf47b
commit
ee27329728
@ -4,13 +4,11 @@ namespace SilverStripe\Core\Cache;
|
||||
|
||||
/**
|
||||
* Defines a service that can flush its cache for a list of members
|
||||
* @package SilverStripe\Core\Cache
|
||||
*/
|
||||
interface MemberCacheFlusher
|
||||
{
|
||||
/**
|
||||
* @param null $memberIDs
|
||||
* @return mixed
|
||||
* @param array $memberIDs
|
||||
*/
|
||||
public function flushMemberCache($memberIDs = null);
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ class InheritedPermissionFlusher extends DataExtension implements Flushable
|
||||
public function flushCache()
|
||||
{
|
||||
$ids = $this->getMemberIDList();
|
||||
foreach ($this->services as $service) {
|
||||
foreach ($this->getServices() as $service) {
|
||||
$service->flushMemberCache($ids);
|
||||
}
|
||||
}
|
||||
@ -101,4 +101,4 @@ class InheritedPermissionFlusher extends DataExtension implements Flushable
|
||||
|
||||
return [$this->owner->ID];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,12 @@ namespace SilverStripe\Security\Tests;
|
||||
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
use SilverStripe\Core\Cache\CacheFactory;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Dev\SapphireTest;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\InheritedPermissionFlusher;
|
||||
use SilverStripe\Security\Member;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Core\Injector\Injector;
|
||||
use SilverStripe\Security\Tests\InheritedPermissionsFlusherTest\TestCacheFlusher;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
|
||||
class InheritedPermissionsFlusherTest extends SapphireTest
|
||||
{
|
||||
@ -59,7 +58,9 @@ class InheritedPermissionsFlusherTest extends SapphireTest
|
||||
$extension = new InheritedPermissionFlusher();
|
||||
$extension->setServices([$flusher]);
|
||||
Injector::inst()->registerService($extension, InheritedPermissionFlusher::class);
|
||||
/** @var Group $editors */
|
||||
$editors = $this->objFromFixture(Group::class, 'editors');
|
||||
/** @var Group $admins */
|
||||
$admins = $this->objFromFixture(Group::class, 'admins');
|
||||
|
||||
// Populate the cache for all members in each group
|
||||
@ -97,4 +98,4 @@ class InheritedPermissionsFlusherTest extends SapphireTest
|
||||
$this->assertNull($cache->get($editorKey));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,4 +32,4 @@ SilverStripe\Security\Member:
|
||||
allsections:
|
||||
Groups: =>SilverStripe\Security\Group.allsections
|
||||
securityadmin:
|
||||
Groups: =>SilverStripe\Security\Group.securityadmins
|
||||
Groups: =>SilverStripe\Security\Group.securityadmins
|
||||
|
@ -32,6 +32,7 @@ class TestCacheFlusher implements MemberCacheFlusher
|
||||
|
||||
/**
|
||||
* Clear the cache for this instance only
|
||||
*
|
||||
* @param array $memberIDs A list of member IDs
|
||||
*/
|
||||
public function flushMemberCache($memberIDs = null)
|
||||
@ -64,4 +65,4 @@ class TestCacheFlusher implements MemberCacheFlusher
|
||||
{
|
||||
return "{$category}__{$memberID}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user