From 0cf477d36e7cadbc07c91dea87947e2d3e32930f Mon Sep 17 00:00:00 2001 From: Mike Cochrane Date: Tue, 3 Jan 2017 20:37:17 +1300 Subject: [PATCH] Use SiteTree instead of Page class in more places --- admin/code/LeftAndMain.php | 2 +- src/Forms/HTMLEditor/HTMLEditorField_Toolbar.php | 4 ++-- src/Security/Security.php | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/code/LeftAndMain.php b/admin/code/LeftAndMain.php index f4a83f10a..041b4c8aa 100644 --- a/admin/code/LeftAndMain.php +++ b/admin/code/LeftAndMain.php @@ -1457,7 +1457,7 @@ class LeftAndMain extends Controller implements PermissionProvider $id = $request->requestVar('ID'); $parentID = $request->requestVar('ParentID'); - if ($className == 'SilverStripe\\CMS\\Model\\SiteTree' && $page = DataObject::get_by_id('Page', $id)) { + if ($className == 'SilverStripe\\CMS\\Model\\SiteTree' && $page = DataObject::get_by_id(SiteTree::class, $id)) { $root = $page->getParentType(); if (($parentID == '0' || $root == 'root') && !SiteConfig::current_site_config()->canCreateTopLevel()) { $this->getResponse()->setStatusCode( diff --git a/src/Forms/HTMLEditor/HTMLEditorField_Toolbar.php b/src/Forms/HTMLEditor/HTMLEditorField_Toolbar.php index 1957e197b..4b3ea01bc 100644 --- a/src/Forms/HTMLEditor/HTMLEditorField_Toolbar.php +++ b/src/Forms/HTMLEditor/HTMLEditorField_Toolbar.php @@ -2,9 +2,9 @@ namespace SilverStripe\Forms\HTMLEditor; -use Page; use SilverStripe\Assets\File; use SilverStripe\Assets\Upload; +use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\RequestHandler; @@ -516,7 +516,7 @@ class HTMLEditorField_Toolbar extends RequestHandler $id = (int)$this->getRequest()->getVar('PageID'); $anchors = array(); - if (($page = Page::get()->byID($id)) && !empty($page)) { + if (($page = SiteTree::get()->byID($id)) && !empty($page)) { if (!$page->canView()) { throw new HTTPResponse_Exception( _t( diff --git a/src/Security/Security.php b/src/Security/Security.php index 09d480a70..7d6910ebe 100644 --- a/src/Security/Security.php +++ b/src/Security/Security.php @@ -2,14 +2,16 @@ namespace SilverStripe\Security; +use SilverStripe\CMS\Controllers\ContentController; +use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Control\Controller; use SilverStripe\Control\Director; use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPResponse; use SilverStripe\Control\Session; +use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Config\Config; use SilverStripe\Core\Convert; -use SilverStripe\Core\ClassInfo; use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\Deprecation; use SilverStripe\Dev\TestOnly; @@ -18,16 +20,14 @@ use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; use SilverStripe\ORM\ArrayList; -use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DB; +use SilverStripe\ORM\DataObject; use SilverStripe\ORM\FieldType\DBField; use SilverStripe\ORM\ValidationResult; use SilverStripe\View\ArrayData; use SilverStripe\View\SSViewer; use SilverStripe\View\TemplateGlobalProvider; use Exception; -use Page; -use Page_Controller; use Subsite; /** @@ -515,14 +515,14 @@ class Security extends Controller implements TemplateGlobalProvider } // Use sitetree pages to render the security page - $tmpPage = new Page(); + $tmpPage = new SiteTree(); $tmpPage->Title = $title; /** @skipUpgrade */ $tmpPage->URLSegment = "Security"; // Disable ID-based caching of the log-in page by making it a random number $tmpPage->ID = -1 * rand(1, 10000000); - $controller = Page_Controller::create($tmpPage); + $controller = ContentController::create($tmpPage); $controller->setDataModel($this->model); $controller->doInit(); return $controller;