Use SiteTree instead of Page class in more places

This commit is contained in:
Mike Cochrane 2017-01-03 20:37:17 +13:00
parent 6d8defcc1e
commit 0cf477d36e
3 changed files with 9 additions and 9 deletions

View File

@ -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(

View File

@ -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(

View File

@ -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;