mirror of
https://github.com/silverstripe/silverstripe-subsites
synced 2024-10-22 11:05:55 +02:00
upgrader: upgrade code
This commit is contained in:
parent
2c84e627db
commit
e33a5b4cae
@ -1,7 +1,7 @@
|
||||
---
|
||||
Name: subsiteconfig
|
||||
---
|
||||
AssetAdmin:
|
||||
SilverStripe\AssetAdmin\Controller\AssetAdmin:
|
||||
treats_subsite_0_as_global: true
|
||||
|
||||
SilverStripe\Control\Director:
|
||||
|
@ -5,6 +5,8 @@ namespace SilverStripe\Subsites\Admin;
|
||||
|
||||
use SilverStripe\Admin\ModelAdmin;
|
||||
use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
/**
|
||||
* Admin interface to manage and create {@link Subsite} instances.
|
||||
@ -13,7 +15,7 @@ use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm;
|
||||
*/
|
||||
class SubsiteAdmin extends ModelAdmin {
|
||||
|
||||
private static $managed_models = array('Subsite');
|
||||
private static $managed_models = array(Subsite::class);
|
||||
|
||||
private static $url_segment = 'subsites';
|
||||
|
||||
@ -23,12 +25,12 @@ class SubsiteAdmin extends ModelAdmin {
|
||||
|
||||
public $showImportForm=false;
|
||||
|
||||
private static $tree_class = 'Subsite';
|
||||
private static $tree_class = Subsite::class;
|
||||
|
||||
public function getEditForm($id = null, $fields = null) {
|
||||
$form = parent::getEditForm($id, $fields);
|
||||
|
||||
$grid=$form->Fields()->dataFieldByName('Subsite');
|
||||
$grid=$form->Fields()->dataFieldByName(Subsite::class);
|
||||
if($grid) {
|
||||
$grid->getConfig()->removeComponentsByType('SilverStripe\\Forms\\GridField\\GridFieldDetailForm');
|
||||
$grid->getConfig()->addComponent(new GridFieldSubsiteDetailForm());
|
||||
|
@ -6,6 +6,8 @@ namespace SilverStripe\Subsites\Extensions;
|
||||
use SilverStripe\ORM\DataObject;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
class ErrorPageSubsite extends DataExtension {
|
||||
|
||||
@ -29,7 +31,7 @@ class ErrorPageSubsite extends DataExtension {
|
||||
if(!$subsite) {
|
||||
$subsiteID = Subsite::getSubsiteIDForDomain();
|
||||
if($subsiteID != 0) {
|
||||
$subsite = DataObject::get_by_id("Subsite", $subsiteID);
|
||||
$subsite = DataObject::get_by_id(Subsite::class, $subsiteID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,8 @@ use SilverStripe\Control\Session;
|
||||
use SilverStripe\Security\Permission;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
/**
|
||||
* Extension for the File object to add subsites support
|
||||
@ -26,7 +28,7 @@ class FileSubsites extends DataExtension {
|
||||
static $default_root_folders_global = false;
|
||||
|
||||
private static $has_one=array(
|
||||
'Subsite' => 'Subsite',
|
||||
'Subsite' => Subsite::class,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -54,7 +56,7 @@ class FileSubsites extends DataExtension {
|
||||
//Dropdown needed to move folders between subsites
|
||||
$dropdown = new DropdownField(
|
||||
'SubsiteID',
|
||||
_t('FileSubsites.SubsiteFieldLabel','Subsite'),
|
||||
_t('FileSubsites.SubsiteFieldLabel',Subsite::class),
|
||||
$values
|
||||
);
|
||||
$dropdown->addExtraClass('subsites-move-dropdown');
|
||||
|
@ -15,6 +15,8 @@ use SilverStripe\Control\Cookie;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Security\PermissionProvider;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\Security\Group;
|
||||
|
||||
|
||||
/**
|
||||
* Extension for the Group object to add subsites support
|
||||
@ -28,7 +30,7 @@ class GroupSubsites extends DataExtension implements PermissionProvider {
|
||||
);
|
||||
|
||||
private static $many_many = array(
|
||||
'Subsites' => 'Subsite'
|
||||
'Subsites' => Subsite::class
|
||||
);
|
||||
|
||||
private static $defaults = array(
|
||||
@ -40,7 +42,7 @@ class GroupSubsites extends DataExtension implements PermissionProvider {
|
||||
*/
|
||||
function requireDefaultRecords() {
|
||||
// Migration for Group.SubsiteID data from when Groups only had a single subsite
|
||||
$groupFields = DB::field_list('Group');
|
||||
$groupFields = DB::field_list(Group::class);
|
||||
|
||||
// Detection of SubsiteID field is the trigger for old-style-subsiteID migration
|
||||
if(isset($groupFields['SubsiteID'])) {
|
||||
@ -52,7 +54,7 @@ class GroupSubsites extends DataExtension implements PermissionProvider {
|
||||
DB::query('UPDATE "Group" SET "AccessAllSubsites" = 1 WHERE "SubsiteID" = 0');
|
||||
|
||||
// Move the field out of the way so that this migration doesn't get executed again
|
||||
DB::get_schema()->renameField('Group', 'SubsiteID', '_obsolete_SubsiteID');
|
||||
DB::get_schema()->renameField(Group::class, 'SubsiteID', '_obsolete_SubsiteID');
|
||||
|
||||
// No subsite access on anything means that we've just installed the subsites module.
|
||||
// Make all previous groups global-access groups
|
||||
|
@ -19,6 +19,7 @@ use SilverStripe\Control\Controller;
|
||||
use SilverStripe\Core\Extension;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
/**
|
||||
* Decorator designed to add subsites support to LeftAndMain
|
||||
*
|
||||
@ -316,7 +317,7 @@ class LeftAndMainSubsites extends Extension {
|
||||
|
||||
function copytosubsite($data, $form) {
|
||||
$page = DataObject::get_by_id('SilverStripe\\CMS\\Model\\SiteTree', $data['ID']);
|
||||
$subsite = DataObject::get_by_id('Subsite', $data['CopyToSubsiteID']);
|
||||
$subsite = DataObject::get_by_id(Subsite::class, $data['CopyToSubsiteID']);
|
||||
$newPage = $page->duplicateToSubsite($subsite->ID, true);
|
||||
$response = $this->owner->getResponse();
|
||||
$response->addHeader('X-Reload', true);
|
||||
|
@ -9,6 +9,8 @@ use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\Forms\HiddenField;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\SiteConfig\SiteConfig;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -17,7 +19,7 @@ use SilverStripe\Subsites\Model\Subsite;
|
||||
class SiteConfigSubsites extends DataExtension {
|
||||
|
||||
private static $has_one = array(
|
||||
'Subsite' => 'Subsite', // The subsite that this page belongs to
|
||||
'Subsite' => Subsite::class, // The subsite that this page belongs to
|
||||
);
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@ class SiteConfigSubsites extends DataExtension {
|
||||
$froms=$query->getFrom();
|
||||
$froms=array_keys($froms);
|
||||
$tableName = array_shift($froms);
|
||||
if($tableName != 'SiteConfig') return;
|
||||
if($tableName != SiteConfig::class) return;
|
||||
$query->addWhere("\"$tableName\".\"SubsiteID\" IN ($subsiteID)");
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@ use SilverStripe\Core\Convert;
|
||||
use SilverStripe\ORM\DataExtension;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use Page;
|
||||
use SilverStripe\CMS\Model\SiteTree;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -27,7 +29,7 @@ use Page;
|
||||
class SiteTreeSubsites extends DataExtension {
|
||||
|
||||
private static $has_one = array(
|
||||
'Subsite' => 'Subsite', // The subsite that this page belongs to
|
||||
'Subsite' => Subsite::class, // The subsite that this page belongs to
|
||||
);
|
||||
|
||||
private static $many_many = array(
|
||||
@ -63,7 +65,7 @@ class SiteTreeSubsites extends DataExtension {
|
||||
// The foreach is an ugly way of getting the first key :-)
|
||||
foreach($query->getFrom() as $tableName => $info) {
|
||||
// The tableName should be SiteTree or SiteTree_Live...
|
||||
if(strpos($tableName,'SiteTree') === false) break;
|
||||
if(strpos($tableName,SiteTree::class) === false) break;
|
||||
$query->addWhere("\"$tableName\".\"SubsiteID\" IN ($subsiteID)");
|
||||
break;
|
||||
}
|
||||
|
@ -6,10 +6,13 @@ namespace SilverStripe\Subsites\Forms;
|
||||
use SilverStripe\Forms\GridField\GridFieldDetailForm;
|
||||
use SilverStripe\Forms\DropdownField;
|
||||
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
|
||||
use Subsite;
|
||||
|
||||
use SilverStripe\Subsites\Forms\GridFieldSubsiteDetailForm_ItemRequest;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
class GridFieldSubsiteDetailForm extends GridFieldDetailForm {
|
||||
protected $itemRequestClass='GridFieldSubsiteDetailForm_ItemRequest';
|
||||
protected $itemRequestClass=GridFieldSubsiteDetailForm_ItemRequest::class;
|
||||
}
|
||||
|
||||
class GridFieldSubsiteDetailForm_ItemRequest extends GridFieldDetailForm_ItemRequest {
|
||||
|
@ -9,10 +9,11 @@ use SilverStripe\Control\Session;
|
||||
use SilverStripe\Forms\TreeDropdownField;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Wraps around a TreedropdownField to add ability for temporary
|
||||
* switching of subsite sessions.
|
||||
*
|
||||
*
|
||||
* @package subsites
|
||||
*/
|
||||
class SubsitesTreeDropdownField extends TreeDropdownField {
|
||||
@ -20,35 +21,35 @@ class SubsitesTreeDropdownField extends TreeDropdownField {
|
||||
private static $allowed_actions = array(
|
||||
'tree'
|
||||
);
|
||||
|
||||
|
||||
protected $subsiteID = 0;
|
||||
|
||||
protected $extraClasses = array('SubsitesTreeDropdownField');
|
||||
|
||||
|
||||
protected $extraClasses = array(SubsitesTreeDropdownField::class);
|
||||
|
||||
function Field($properties = array()) {
|
||||
$html = parent::Field($properties);
|
||||
|
||||
|
||||
Requirements::javascript('subsites/javascript/SubsitesTreeDropdownField.js');
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
function setSubsiteID($id) {
|
||||
$this->subsiteID = $id;
|
||||
}
|
||||
|
||||
|
||||
function getSubsiteID() {
|
||||
return $this->subsiteID;
|
||||
}
|
||||
|
||||
|
||||
function tree(HTTPRequest $request) {
|
||||
$oldSubsiteID = Session::get('SubsiteID');
|
||||
Session::set('SubsiteID', $this->subsiteID);
|
||||
|
||||
|
||||
$results = parent::tree($request);
|
||||
|
||||
|
||||
Session::set('SubsiteID', $oldSubsiteID);
|
||||
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,10 @@ use SilverStripe\Forms\FieldList;
|
||||
use SilverStripe\ORM\ArrayLib;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use UnexpectedValueException;
|
||||
use SilverStripe\Security\Group;
|
||||
use SilverStripe\Security\PermissionRole;
|
||||
use SilverStripe\Security\PermissionRoleCode;
|
||||
|
||||
|
||||
/**
|
||||
* A dynamically created subsite. SiteTree objects can now belong to a subsite.
|
||||
@ -125,7 +129,7 @@ class Subsite extends DataObject {
|
||||
*/
|
||||
public static function currentSubsite() {
|
||||
// get_by_id handles caching so we don't have to
|
||||
return DataObject::get_by_id('Subsite', self::currentSubsiteID());
|
||||
return DataObject::get_by_id(Subsite::class, self::currentSubsiteID());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -208,10 +212,10 @@ class Subsite extends DataObject {
|
||||
|
||||
$SQL_host = Convert::raw2sql($host);
|
||||
$matchingDomains = DataObject::get(
|
||||
"SubsiteDomain",
|
||||
SubsiteDomain::class,
|
||||
"'$SQL_host' LIKE replace(\"SubsiteDomain\".\"Domain\",'*','%')",
|
||||
"\"IsPrimary\" DESC"
|
||||
)->innerJoin('Subsite', "\"Subsite\".\"ID\" = \"SubsiteDomain\".\"SubsiteID\" AND \"Subsite\".\"IsPublic\"=1");
|
||||
)->innerJoin(Subsite::class, "\"Subsite\".\"ID\" = \"SubsiteDomain\".\"SubsiteID\" AND \"Subsite\".\"IsPublic\"=1");
|
||||
}
|
||||
|
||||
if($matchingDomains && $matchingDomains->Count()) {
|
||||
@ -226,7 +230,7 @@ class Subsite extends DataObject {
|
||||
}
|
||||
|
||||
$subsiteID = $subsiteIDs[0];
|
||||
} else if($default = DataObject::get_one('Subsite', "\"DefaultSite\" = 1")) {
|
||||
} else if($default = DataObject::get_one(Subsite::class, "\"DefaultSite\" = 1")) {
|
||||
// Check for a 'default' subsite
|
||||
$subsiteID = $default->ID;
|
||||
} else {
|
||||
@ -352,23 +356,23 @@ class Subsite extends DataObject {
|
||||
return self::$_cache_accessible_sites[$cacheKey];
|
||||
}
|
||||
|
||||
$subsites = DataList::create('Subsite')
|
||||
$subsites = DataList::create(Subsite::class)
|
||||
->where("\"Subsite\".\"Title\" != ''")
|
||||
->leftJoin('Group_Subsites', "\"Group_Subsites\".\"SubsiteID\" = \"Subsite\".\"ID\"")
|
||||
->innerJoin('Group', "\"Group\".\"ID\" = \"Group_Subsites\".\"GroupID\" OR \"Group\".\"AccessAllSubsites\" = 1")
|
||||
->innerJoin(Group::class, "\"Group\".\"ID\" = \"Group_Subsites\".\"GroupID\" OR \"Group\".\"AccessAllSubsites\" = 1")
|
||||
->innerJoin('Group_Members', "\"Group_Members\".\"GroupID\"=\"Group\".\"ID\" AND \"Group_Members\".\"MemberID\" = $member->ID")
|
||||
->innerJoin('Permission', "\"Group\".\"ID\"=\"Permission\".\"GroupID\" AND \"Permission\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')");
|
||||
->innerJoin(Permission::class, "\"Group\".\"ID\"=\"Permission\".\"GroupID\" AND \"Permission\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')");
|
||||
|
||||
if(!$subsites) $subsites = new ArrayList();
|
||||
|
||||
$rolesSubsites = DataList::create('Subsite')
|
||||
$rolesSubsites = DataList::create(Subsite::class)
|
||||
->where("\"Subsite\".\"Title\" != ''")
|
||||
->leftJoin('Group_Subsites', "\"Group_Subsites\".\"SubsiteID\" = \"Subsite\".\"ID\"")
|
||||
->innerJoin('Group', "\"Group\".\"ID\" = \"Group_Subsites\".\"GroupID\" OR \"Group\".\"AccessAllSubsites\" = 1")
|
||||
->innerJoin(Group::class, "\"Group\".\"ID\" = \"Group_Subsites\".\"GroupID\" OR \"Group\".\"AccessAllSubsites\" = 1")
|
||||
->innerJoin('Group_Members', "\"Group_Members\".\"GroupID\"=\"Group\".\"ID\" AND \"Group_Members\".\"MemberID\" = $member->ID")
|
||||
->innerJoin('Group_Roles', "\"Group_Roles\".\"GroupID\"=\"Group\".\"ID\"")
|
||||
->innerJoin('PermissionRole', "\"Group_Roles\".\"PermissionRoleID\"=\"PermissionRole\".\"ID\"")
|
||||
->innerJoin('PermissionRoleCode', "\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\" AND \"PermissionRoleCode\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')");
|
||||
->innerJoin(PermissionRole::class, "\"Group_Roles\".\"PermissionRoleID\"=\"PermissionRole\".\"ID\"")
|
||||
->innerJoin(PermissionRoleCode::class, "\"PermissionRole\".\"ID\"=\"PermissionRoleCode\".\"RoleID\" AND \"PermissionRoleCode\".\"Code\" IN ($SQL_codes, 'CMS_ACCESS_LeftAndMain', 'ADMIN')");
|
||||
|
||||
if(!$subsites && $rolesSubsites) return $rolesSubsites;
|
||||
|
||||
@ -411,7 +415,7 @@ class Subsite extends DataObject {
|
||||
if (!$file) $file = Director::baseFolder().'/subsites/host-map.php';
|
||||
$hostmap = array();
|
||||
|
||||
$subsites = DataObject::get('Subsite');
|
||||
$subsites = DataObject::get(Subsite::class);
|
||||
|
||||
if ($subsites) foreach($subsites as $subsite) {
|
||||
$domains = $subsite->Domains();
|
||||
@ -510,7 +514,7 @@ class Subsite extends DataObject {
|
||||
* @var array
|
||||
*/
|
||||
private static $has_many = array(
|
||||
'Domains' => 'SubsiteDomain',
|
||||
'Domains' => SubsiteDomain::class,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -714,7 +718,7 @@ class Subsite extends DataObject {
|
||||
*/
|
||||
public function domain() {
|
||||
if($this->ID) {
|
||||
$domains = DataObject::get("SubsiteDomain", "\"SubsiteID\" = $this->ID", "\"IsPrimary\" DESC","", 1);
|
||||
$domains = DataObject::get(SubsiteDomain::class, "\"SubsiteID\" = $this->ID", "\"IsPrimary\" DESC","", 1);
|
||||
if($domains && $domains->Count()>0) {
|
||||
$domain = $domains->First()->Domain;
|
||||
// If there are wildcards in the primary domain (not recommended), make some
|
||||
|
@ -37,7 +37,7 @@ class SubsiteDomain extends DataObject {
|
||||
* @var array
|
||||
*/
|
||||
private static $has_one = array(
|
||||
"Subsite" => "Subsite",
|
||||
"Subsite" => Subsite::class,
|
||||
);
|
||||
|
||||
/**
|
||||
@ -57,9 +57,9 @@ class SubsiteDomain extends DataObject {
|
||||
public function onAfterWrite() {
|
||||
Subsite::writeHostMap();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @return \FieldList
|
||||
*/
|
||||
public function getCMSFields() {
|
||||
@ -73,7 +73,7 @@ class SubsiteDomain extends DataObject {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param bool $includerelations
|
||||
* @return array
|
||||
*/
|
||||
|
@ -14,9 +14,12 @@ use SilverStripe\Forms\TextareaField;
|
||||
use SilverStripe\Control\Session;
|
||||
use SilverStripe\Core\Config\Config;
|
||||
use SilverStripe\CMS\Model\VirtualPage;
|
||||
use SilverStripe\CMS\Model\VirtualPage_Controller;
|
||||
use SubsitesTreeDropdownField;
|
||||
use Subsite;
|
||||
use SilverStripe\CMS\Model\VirtualPageController;
|
||||
|
||||
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\Subsites\Forms\SubsitesTreeDropdownField;
|
||||
|
||||
|
||||
class SubsitesVirtualPage extends VirtualPage {
|
||||
|
||||
@ -32,7 +35,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
||||
public function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$subsites = DataObject::get('Subsite');
|
||||
$subsites = DataObject::get(Subsite::class);
|
||||
if(!$subsites) {
|
||||
$subsites = new ArrayList();
|
||||
}else {
|
||||
@ -45,7 +48,7 @@ class SubsitesVirtualPage extends VirtualPage {
|
||||
'Root.Main',
|
||||
DropdownField::create(
|
||||
"CopyContentFromID_SubsiteID",
|
||||
_t('SubsitesVirtualPage.SubsiteField',"Subsite"),
|
||||
_t('SubsitesVirtualPage.SubsiteField',Subsite::class),
|
||||
$subsites->map('ID', 'Title')
|
||||
)->addExtraClass('subsitestreedropdownfield-chooser no-change-track'),
|
||||
'CopyContentFromID'
|
||||
|
@ -9,6 +9,7 @@ use SilverStripe\Reports\ReportWrapper;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates a subsite-aware version of another report.
|
||||
* Pass another report (or its classname) into the constructor.
|
||||
@ -47,7 +48,7 @@ class SubsiteReportWrapper extends ReportWrapper {
|
||||
|
||||
function columns() {
|
||||
$columns = parent::columns();
|
||||
$columns['Subsite.Title'] = "Subsite";
|
||||
$columns['Subsite.Title'] = Subsite::class;
|
||||
return $columns;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,8 @@ use SilverStripe\Dev\BuildTask;
|
||||
use InvalidArgumentException;
|
||||
use SilverStripe\Subsites\Model\Subsite;
|
||||
use SilverStripe\Versioned\Versioned;
|
||||
use SubsitesVirtualPage;
|
||||
use SilverStripe\Subsites\Pages\SubsitesVirtualPage;
|
||||
|
||||
|
||||
/**
|
||||
* Handy alternative to copying pages when creating a subsite through the UI.
|
||||
@ -26,12 +27,12 @@ class SubsiteCopyPagesTask extends BuildTask {
|
||||
function run($request) {
|
||||
$subsiteFromId = $request->getVar('from');
|
||||
if(!is_numeric($subsiteFromId)) throw new InvalidArgumentException('Missing "from" parameter');
|
||||
$subsiteFrom = DataObject::get_by_id('Subsite', $subsiteFromId);
|
||||
$subsiteFrom = DataObject::get_by_id(Subsite::class, $subsiteFromId);
|
||||
if(!$subsiteFrom) throw new InvalidArgumentException('Subsite not found');
|
||||
|
||||
$subsiteToId = $request->getVar('to');
|
||||
if(!is_numeric($subsiteToId)) throw new InvalidArgumentException('Missing "to" parameter');
|
||||
$subsiteTo = DataObject::get_by_id('Subsite', $subsiteToId);
|
||||
$subsiteTo = DataObject::get_by_id(Subsite::class, $subsiteToId);
|
||||
if(!$subsiteTo) throw new InvalidArgumentException('Subsite not found');
|
||||
|
||||
$useVirtualPages = (bool)$request->getVar('virtual');
|
||||
|
Loading…
Reference in New Issue
Block a user