FIX updated depreated Member::currentUser() references

This commit is contained in:
Franco Springveldt 2017-09-14 09:53:29 +12:00
parent b444db1af8
commit aec1d542b1
6 changed files with 13 additions and 8 deletions

View File

@ -27,6 +27,7 @@ use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionProvider;
use SilverStripe\Security\Security;
use SilverStripe\View\Requirements;
/**
@ -216,7 +217,7 @@ class Blog extends Page implements PermissionProvider
protected function getMember($member = null)
{
if (!$member) {
$member = Member::currentUser();
$member = Security::getCurrentUser();
}
if (is_numeric($member)) {

View File

@ -22,6 +22,7 @@ use SilverStripe\ORM\UnsavedRelationList;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\Security;
use SilverStripe\TagField\TagField;
use SilverStripe\View\ArrayData;
use SilverStripe\View\Requirements;
@ -387,7 +388,7 @@ class BlogPost extends Page
protected function getMember($member = null)
{
if (!$member) {
$member = Member::currentUser();
$member = Security::getCurrentUser();
}
if (is_numeric($member)) {
@ -746,7 +747,7 @@ class BlogPost extends Page
{
parent::onBeforeWrite();
if (!$this->exists() && ($member = Member::currentUser())) {
if (!$this->exists() && ($member = Security::getCurrentUser())) {
$this->Authors()->add($member);
}
}

View File

@ -11,6 +11,7 @@ use SilverStripe\Dev\FunctionalTest;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\ValidationException;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
/**
* @mixin PHPUnit_Framework_TestCase
@ -48,7 +49,7 @@ class BlogCategoryTest extends FunctionalTest
*/
public function testBlogPosts()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
$member->logout();

View File

@ -6,6 +6,7 @@ use SilverStripe\Blog\Model\Blog;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
/**
* @mixin PHPUnit_Framework_TestCase
@ -38,7 +39,7 @@ class BlogPostFilterTest extends SapphireTest
*/
public function testFilter()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
$member->logout();

View File

@ -48,7 +48,7 @@ class BlogTagTest extends FunctionalTest
*/
public function testBlogPosts()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
$member->logout();

View File

@ -16,6 +16,7 @@ use SilverStripe\ORM\DataModel;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\SS_List;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
/**
* @mixin PHPUnit_Framework_TestCase
@ -58,7 +59,7 @@ class BlogTest extends SapphireTest
public function testGetExcludedSiteTreeClassNames()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
$member->logout();
@ -82,7 +83,7 @@ class BlogTest extends SapphireTest
public function testGetArchivedBlogPosts()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
$member->logout();