mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
Merge pull request #493 from creative-commoners/pulls/2/stop-using-depr
API Stop using deprecated API
This commit is contained in:
commit
f45ccead3c
@ -245,6 +245,7 @@ class SiteTreeSubsites extends DataExtension
|
||||
*/
|
||||
public function duplicateToSubsite($subsiteID = null, $includeChildren = false)
|
||||
{
|
||||
/** @var SiteTree|SiteTreeSubsites */
|
||||
$clone = $this->owner->duplicateToSubsitePrep($subsiteID, $includeChildren);
|
||||
$clone->invokeWithExtensions('onBeforeDuplicateToSubsite', $this->owner);
|
||||
|
||||
@ -267,12 +268,13 @@ class SiteTreeSubsites extends DataExtension
|
||||
* It may be that some relations are not diostinct to sub site so can stay
|
||||
* whereas others may need to be duplicated
|
||||
*
|
||||
* @deprecated 2.2.0 Use the "cascade_duplicates" config API instead
|
||||
* This was originally deprecated - Use the "cascade_duplicates" config API instead
|
||||
* Ideally this would be re-deprecated
|
||||
*
|
||||
* @param SiteTree $originalPage
|
||||
*/
|
||||
public function duplicateSubsiteRelations($originalPage)
|
||||
{
|
||||
Deprecation::notice('2.2.0', 'Use the "cascade_duplicates" config API instead');
|
||||
$thisClass = $originalPage->ClassName;
|
||||
$relations = Config::inst()->get($thisClass, 'duplicate_to_subsite_relations');
|
||||
|
||||
|
@ -448,7 +448,7 @@ class Subsite extends DataObject
|
||||
|
||||
// Rationalise member arguments
|
||||
if (!$member) {
|
||||
$member = Member::currentUser();
|
||||
$member = Security::getCurrentUser();
|
||||
}
|
||||
if (!$member) {
|
||||
return new ArrayList();
|
||||
|
@ -38,19 +38,19 @@ class LeftAndMainSubsitesTest extends FunctionalTest
|
||||
|
||||
$cmsmain = singleton(CMSMain::class);
|
||||
$subsites = $cmsmain->sectionSites(true, 'Main site', $member);
|
||||
$this->assertDOSEquals([
|
||||
$this->assertListEquals([
|
||||
['Title' => 'Subsite1 Template']
|
||||
], $subsites, 'Lists member-accessible sites for the accessible controller.');
|
||||
|
||||
$assetadmin = singleton(AssetAdmin::class);
|
||||
$subsites = $assetadmin->sectionSites(true, 'Main site', $member);
|
||||
$this->assertDOSEquals([], $subsites, 'Does not list any sites for forbidden controller.');
|
||||
$this->assertListEquals([], $subsites, 'Does not list any sites for forbidden controller.');
|
||||
|
||||
$member = $this->objFromFixture(Member::class, 'editor');
|
||||
|
||||
$cmsmain = singleton(CMSMain::class);
|
||||
$subsites = $cmsmain->sectionSites(true, 'Main site', $member);
|
||||
$this->assertDOSContains([
|
||||
$this->assertListContains([
|
||||
['Title' => 'Main site']
|
||||
], $subsites, 'Includes the main site for members who can access all sites.');
|
||||
}
|
||||
|
@ -350,7 +350,7 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
public function testAllSites()
|
||||
{
|
||||
$subsites = Subsite::all_sites();
|
||||
$this->assertDOSEquals([
|
||||
$this->assertListEquals([
|
||||
['Title' => 'Main site'],
|
||||
['Title' => 'Template'],
|
||||
['Title' => 'Subsite1 Template'],
|
||||
@ -370,7 +370,7 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
$member = $this->objFromFixture(Member::class, 'subsite1member');
|
||||
|
||||
$subsites = Subsite::all_accessible_sites(true, 'Main site', $member);
|
||||
$this->assertDOSEquals([
|
||||
$this->assertListEquals([
|
||||
['Title' => 'Subsite1 Template']
|
||||
], $subsites, 'Lists member-accessible sites.');
|
||||
}
|
||||
@ -471,7 +471,7 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
$page1 = new Page();
|
||||
$page1->Title = 'MyAwesomePage';
|
||||
$page1->write();
|
||||
$page1->doPublish();
|
||||
$page1->publishRecursive();
|
||||
$this->assertEquals($page1->SubsiteID, $subsite1->ID);
|
||||
|
||||
// duplicate
|
||||
@ -481,7 +481,7 @@ class SubsiteTest extends BaseSubsiteTest
|
||||
$page2 = DataObject::get_one('Page', "\"Title\" = 'MyAwesomePage'");
|
||||
$page2->Title = 'MyNewAwesomePage';
|
||||
$page2->write();
|
||||
$page2->doPublish();
|
||||
$page2->publishRecursive();
|
||||
|
||||
// check change & check change has not affected subiste1
|
||||
$subsite1->activate();
|
||||
|
Loading…
Reference in New Issue
Block a user