mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1606 from open-sausages/pulls/4.0/ss-rename
Rename SS_ prefixed class names
This commit is contained in:
commit
461abae189
@ -12,12 +12,12 @@ use SilverStripe\CMS\Model\SiteTree;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Core\SS_Cache;
|
use SilverStripe\Core\Cache;
|
||||||
use SilverStripe\Forms\DateField;
|
use SilverStripe\Forms\DateField;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Forms\FieldGroup;
|
use SilverStripe\Forms\FieldGroup;
|
||||||
@ -488,7 +488,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
|
foreach($classes as $class) $cacheCanCreate[$class] = singleton($class)->canCreate();
|
||||||
|
|
||||||
// Generate basic cache key. Too complex to encompass all variations
|
// Generate basic cache key. Too complex to encompass all variations
|
||||||
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
$cache = Cache::factory('CMSMain_SiteTreeHints');
|
||||||
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
$cacheKey = md5(implode('_', array(Member::currentUserID(), implode(',', $cacheCanCreate), implode(',', $classes))));
|
||||||
if($this->getRequest()->getVar('flush')) {
|
if($this->getRequest()->getVar('flush')) {
|
||||||
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
$cache->clean(Zend_Cache::CLEANING_MODE_ALL);
|
||||||
@ -763,7 +763,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
public function treeview($request) {
|
public function treeview($request) {
|
||||||
@ -771,7 +771,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
*/
|
*/
|
||||||
public function listview($request) {
|
public function listview($request) {
|
||||||
@ -782,8 +782,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* Callback to request the list of page types allowed under a given page instance.
|
* Callback to request the list of page types allowed under a given page instance.
|
||||||
* Provides a slower but more precise response over SiteTreeHints
|
* Provides a slower but more precise response over SiteTreeHints
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function childfilter($request) {
|
public function childfilter($request) {
|
||||||
// Check valid parent specified
|
// Check valid parent specified
|
||||||
@ -963,8 +963,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function save($data, $form) {
|
public function save($data, $form) {
|
||||||
$className = $this->stat('tree_class');
|
$className = $this->stat('tree_class');
|
||||||
@ -979,7 +979,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
if(!$record || !$record->ID) {
|
if(!$record || !$record->ID) {
|
||||||
throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!$className::singleton()->canCreate()) {
|
if(!$className::singleton()->canCreate()) {
|
||||||
@ -1039,7 +1039,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
* @param int|string $id
|
* @param int|string $id
|
||||||
* @param bool $setID
|
* @param bool $setID
|
||||||
* @return mixed|DataObject
|
* @return mixed|DataObject
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function getNewItem($id, $setID = true) {
|
public function getNewItem($id, $setID = true) {
|
||||||
$parentClass = $this->stat('tree_class');
|
$parentClass = $this->stat('tree_class');
|
||||||
@ -1050,7 +1050,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
if (!$response) {
|
if (!$response) {
|
||||||
$response = $this->getResponse();
|
$response = $this->getResponse();
|
||||||
}
|
}
|
||||||
throw new SS_HTTPResponse_Exception($response);
|
throw new HTTPResponse_Exception($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var SiteTree $newItem */
|
/** @var SiteTree $newItem */
|
||||||
@ -1112,18 +1112,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function revert($data, $form) {
|
public function revert($data, $form) {
|
||||||
if(!isset($data['ID'])) {
|
if(!isset($data['ID'])) {
|
||||||
throw new SS_HTTPResponse_Exception("Please pass an ID in the form content", 400);
|
throw new HTTPResponse_Exception("Please pass an ID in the form content", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int) $data['ID'];
|
$id = (int) $data['ID'];
|
||||||
$restoredPage = Versioned::get_latest_version("SilverStripe\\CMS\\Model\\SiteTree", $id);
|
$restoredPage = Versioned::get_latest_version("SilverStripe\\CMS\\Model\\SiteTree", $id);
|
||||||
if(!$restoredPage) {
|
if(!$restoredPage) {
|
||||||
throw new SS_HTTPResponse_Exception("SiteTree #$id not found", 400);
|
throw new HTTPResponse_Exception("SiteTree #$id not found", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var SiteTree $record */
|
/** @var SiteTree $record */
|
||||||
@ -1137,7 +1137,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
if(!$record || !$record->ID) {
|
if(!$record || !$record->ID) {
|
||||||
throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$record->doRevertToLive();
|
$record->doRevertToLive();
|
||||||
@ -1162,8 +1162,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function delete($data, $form) {
|
public function delete($data, $form) {
|
||||||
$id = $data['ID'];
|
$id = $data['ID'];
|
||||||
@ -1172,7 +1172,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return Security::permissionFailure();
|
return Security::permissionFailure();
|
||||||
}
|
}
|
||||||
if(!$record || !$record->ID) {
|
if(!$record || !$record->ID) {
|
||||||
throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete record
|
// Delete record
|
||||||
@ -1192,15 +1192,15 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function archive($data, $form) {
|
public function archive($data, $form) {
|
||||||
$id = $data['ID'];
|
$id = $data['ID'];
|
||||||
/** @var SiteTree $record */
|
/** @var SiteTree $record */
|
||||||
$record = SiteTree::get()->byID($id);
|
$record = SiteTree::get()->byID($id);
|
||||||
if(!$record || !$record->exists()) {
|
if(!$record || !$record->exists()) {
|
||||||
throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
}
|
}
|
||||||
if(!$record->canArchive()) {
|
if(!$record->canArchive()) {
|
||||||
return Security::permissionFailure();
|
return Security::permissionFailure();
|
||||||
@ -1233,7 +1233,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
if(!$record || !$record->ID) {
|
if(!$record || !$record->ID) {
|
||||||
throw new SS_HTTPResponse_Exception("Bad record ID #" . (int)$data['ID'], 404);
|
throw new HTTPResponse_Exception("Bad record ID #" . (int)$data['ID'], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$record->doUnpublish();
|
$record->doUnpublish();
|
||||||
@ -1247,7 +1247,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function rollback() {
|
public function rollback() {
|
||||||
return $this->doRollback(array(
|
return $this->doRollback(array(
|
||||||
@ -1261,7 +1261,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function doRollback($data, $form) {
|
public function doRollback($data, $form) {
|
||||||
$this->extend('onBeforeRollback', $data['ID']);
|
$this->extend('onBeforeRollback', $data['ID']);
|
||||||
@ -1399,18 +1399,18 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function restore($data, $form) {
|
public function restore($data, $form) {
|
||||||
if(!isset($data['ID']) || !is_numeric($data['ID'])) {
|
if(!isset($data['ID']) || !is_numeric($data['ID'])) {
|
||||||
return new SS_HTTPResponse("Please pass an ID in the form content", 400);
|
return new HTTPResponse("Please pass an ID in the form content", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$id = (int)$data['ID'];
|
$id = (int)$data['ID'];
|
||||||
/** @var SiteTree $restoredPage */
|
/** @var SiteTree $restoredPage */
|
||||||
$restoredPage = Versioned::get_latest_version("SilverStripe\\CMS\\Model\\SiteTree", $id);
|
$restoredPage = Versioned::get_latest_version("SilverStripe\\CMS\\Model\\SiteTree", $id);
|
||||||
if(!$restoredPage) {
|
if(!$restoredPage) {
|
||||||
return new SS_HTTPResponse("SiteTree #$id not found", 400);
|
return new HTTPResponse("SiteTree #$id not found", 400);
|
||||||
}
|
}
|
||||||
|
|
||||||
$restoredPage = $restoredPage->doRestoreToStage();
|
$restoredPage = $restoredPage->doRestoreToStage();
|
||||||
@ -1437,7 +1437,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
if($page && (!$page->canEdit() || !$page->canCreate(null, array('Parent' => $page->Parent())))) {
|
if($page && (!$page->canEdit() || !$page->canCreate(null, array('Parent' => $page->Parent())))) {
|
||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
if(!$page || !$page->ID) throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
if(!$page || !$page->ID) throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
|
|
||||||
$newPage = $page->duplicate();
|
$newPage = $page->duplicate();
|
||||||
|
|
||||||
@ -1462,7 +1462,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->getRequest());
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
} else {
|
} else {
|
||||||
return new SS_HTTPResponse("CMSMain::duplicate() Bad ID: '$id'", 400);
|
return new HTTPResponse("CMSMain::duplicate() Bad ID: '$id'", 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,7 +1476,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
if($page && (!$page->canEdit() || !$page->canCreate(null, array('Parent' => $page->Parent())))) {
|
if($page && (!$page->canEdit() || !$page->canCreate(null, array('Parent' => $page->Parent())))) {
|
||||||
return Security::permissionFailure($this);
|
return Security::permissionFailure($this);
|
||||||
}
|
}
|
||||||
if(!$page || !$page->ID) throw new SS_HTTPResponse_Exception("Bad record ID #$id", 404);
|
if(!$page || !$page->ID) throw new HTTPResponse_Exception("Bad record ID #$id", 404);
|
||||||
|
|
||||||
$newPage = $page->duplicateWithChildren();
|
$newPage = $page->duplicateWithChildren();
|
||||||
|
|
||||||
@ -1495,7 +1495,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
return $this->getResponseNegotiator()->respond($this->getRequest());
|
return $this->getResponseNegotiator()->respond($this->getRequest());
|
||||||
} else {
|
} else {
|
||||||
return new SS_HTTPResponse("CMSMain::duplicatewithchildren() Bad ID: '$id'", 400);
|
return new HTTPResponse("CMSMain::duplicatewithchildren() Bad ID: '$id'", 400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\Forms\FormAction;
|
use SilverStripe\Forms\FormAction;
|
||||||
@ -169,7 +169,7 @@ class CMSPageAddController extends CMSPageEditController {
|
|||||||
/**
|
/**
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function doAdd($data, $form) {
|
public function doAdd($data, $form) {
|
||||||
$className = isset($data['PageType']) ? $data['PageType'] : "Page";
|
$className = isset($data['PageType']) ? $data['PageType'] : "Page";
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
namespace SilverStripe\CMS\Controllers;
|
namespace SilverStripe\CMS\Controllers;
|
||||||
|
|
||||||
use SilverStripe\Admin\AddToCampaignHandler;
|
use SilverStripe\Admin\AddToCampaignHandler;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
use SilverStripe\ORM\FieldType\DBHTMLText;
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
@ -42,7 +42,7 @@ class CMSPageEditController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return DBHTMLText|SS_HTTPResponse
|
* @return DBHTMLText|HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function addtocampaign($data, $form)
|
public function addtocampaign($data, $form)
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ class CMSPageEditController extends CMSMain {
|
|||||||
$data = $this->getSchemaForForm($handler->Form($record));
|
$data = $this->getSchemaForForm($handler->Form($record));
|
||||||
$data['message'] = $results;
|
$data['message'] = $results;
|
||||||
|
|
||||||
$response = new SS_HTTPResponse(Convert::raw2json($data));
|
$response = new HTTPResponse(Convert::raw2json($data));
|
||||||
$response->addHeader('Content-Type', 'application/json');
|
$response->addHeader('Content-Type', 'application/json');
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ class CMSPageEditController extends CMSMain {
|
|||||||
/**
|
/**
|
||||||
* Url handler for add to campaign form
|
* Url handler for add to campaign form
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
public function AddToCampaignForm($request)
|
public function AddToCampaignForm($request)
|
||||||
|
@ -4,8 +4,8 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Forms\Form;
|
use SilverStripe\Forms\Form;
|
||||||
@ -56,7 +56,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function show($request) {
|
public function show($request) {
|
||||||
@ -75,7 +75,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function compare($request) {
|
public function compare($request) {
|
||||||
@ -296,7 +296,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @param Form $form
|
* @param Form $form
|
||||||
* @return SS_HTTPResponse|DBHTMLText
|
* @return HTTPResponse|DBHTMLText
|
||||||
*/
|
*/
|
||||||
public function doCompare($data, $form) {
|
public function doCompare($data, $form) {
|
||||||
$versions = $data['Versions'];
|
$versions = $data['Versions'];
|
||||||
@ -334,7 +334,7 @@ class CMSPageHistoryController extends CMSMain {
|
|||||||
* @param array
|
* @param array
|
||||||
* @param Form
|
* @param Form
|
||||||
*
|
*
|
||||||
* @return DBHTMLText|SS_HTTPResponse
|
* @return DBHTMLText|HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function doShowVersion($data, $form) {
|
public function doShowVersion($data, $form) {
|
||||||
$versionID = null;
|
$versionID = null;
|
||||||
|
@ -6,9 +6,9 @@ use SilverStripe\CMS\Model\SiteTree;
|
|||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\Session;
|
use SilverStripe\Control\Session;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\i18n\i18n;
|
use SilverStripe\i18n\i18n;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
@ -160,12 +160,12 @@ class ContentController extends Controller {
|
|||||||
* This acts the same as {@link Controller::handleRequest()}, but if an action cannot be found this will attempt to
|
* This acts the same as {@link Controller::handleRequest()}, but if an action cannot be found this will attempt to
|
||||||
* fall over to a child controller in order to provide functionality for nested URLs.
|
* fall over to a child controller in order to provide functionality for nested URLs.
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @param DataModel $model
|
* @param DataModel $model
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
|
public function handleRequest(HTTPRequest $request, DataModel $model) {
|
||||||
/** @var SiteTree $child */
|
/** @var SiteTree $child */
|
||||||
$child = null;
|
$child = null;
|
||||||
$action = $request->param('Action');
|
$action = $request->param('Action');
|
||||||
@ -204,9 +204,9 @@ class ContentController extends Controller {
|
|||||||
) {
|
) {
|
||||||
$translation = $this->dataRecord->getTranslation($locale);
|
$translation = $this->dataRecord->getTranslation($locale);
|
||||||
if($translation) {
|
if($translation) {
|
||||||
$response = new SS_HTTPResponse();
|
$response = new HTTPResponse();
|
||||||
$response->redirect($translation->Link(), 301);
|
$response->redirect($translation->Link(), 301);
|
||||||
throw new SS_HTTPResponse_Exception($response);
|
throw new HTTPResponse_Exception($response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -217,7 +217,7 @@ class ContentController extends Controller {
|
|||||||
$response = parent::handleRequest($request, $model);
|
$response = parent::handleRequest($request, $model);
|
||||||
|
|
||||||
Director::set_current_page(null);
|
Director::set_current_page(null);
|
||||||
} catch(SS_HTTPResponse_Exception $e) {
|
} catch(HTTPResponse_Exception $e) {
|
||||||
$this->popCurrent();
|
$this->popCurrent();
|
||||||
|
|
||||||
Director::set_current_page(null);
|
Director::set_current_page(null);
|
||||||
|
@ -4,8 +4,8 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\ErrorPage;
|
use SilverStripe\CMS\Model\ErrorPage;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -17,8 +17,8 @@ class ErrorPageControllerExtension extends Extension {
|
|||||||
* Used by {@see RequestHandler::httpError}
|
* Used by {@see RequestHandler::httpError}
|
||||||
*
|
*
|
||||||
* @param int $statusCode
|
* @param int $statusCode
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function onBeforeHTTPError($statusCode, $request) {
|
public function onBeforeHTTPError($statusCode, $request) {
|
||||||
if (Director::is_ajax()) {
|
if (Director::is_ajax()) {
|
||||||
@ -26,7 +26,7 @@ class ErrorPageControllerExtension extends Extension {
|
|||||||
}
|
}
|
||||||
$response = ErrorPage::response_for($statusCode);
|
$response = ErrorPage::response_for($statusCode);
|
||||||
if($response) {
|
if($response) {
|
||||||
throw new SS_HTTPResponse_Exception($response, $statusCode);
|
throw new HTTPResponse_Exception($response, $statusCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ use SilverStripe\Control\Controller;
|
|||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\NestedController;
|
use SilverStripe\Control\NestedController;
|
||||||
use SilverStripe\Control\RequestHandler;
|
use SilverStripe\Control\RequestHandler;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Injector\Injector;
|
use SilverStripe\Core\Injector\Injector;
|
||||||
use SilverStripe\Dev\Debug;
|
use SilverStripe\Dev\Debug;
|
||||||
@ -63,7 +63,7 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
parent::init();
|
parent::init();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function beforeHandleRequest(SS_HTTPRequest $request, DataModel $model) {
|
protected function beforeHandleRequest(HTTPRequest $request, DataModel $model) {
|
||||||
parent::beforeHandleRequest($request, $model);
|
parent::beforeHandleRequest($request, $model);
|
||||||
// If the database has not yet been created, redirect to the build page.
|
// If the database has not yet been created, redirect to the build page.
|
||||||
/** @skipUpgrade */
|
/** @skipUpgrade */
|
||||||
@ -80,11 +80,11 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @uses ModelAsController::getNestedController()
|
* @uses ModelAsController::getNestedController()
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @param DataModel $model
|
* @param DataModel $model
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
|
public function handleRequest(HTTPRequest $request, DataModel $model) {
|
||||||
$this->beforeHandleRequest($request, $model);
|
$this->beforeHandleRequest($request, $model);
|
||||||
|
|
||||||
// If we had a redirection or something, halt processing.
|
// If we had a redirection or something, halt processing.
|
||||||
@ -107,11 +107,11 @@ class ModelAsController extends Controller implements NestedController {
|
|||||||
|
|
||||||
if($result instanceof RequestHandler) {
|
if($result instanceof RequestHandler) {
|
||||||
$result = $result->handleRequest($this->getRequest(), $model);
|
$result = $result->handleRequest($this->getRequest(), $model);
|
||||||
} else if(!($result instanceof SS_HTTPResponse)) {
|
} else if(!($result instanceof HTTPResponse)) {
|
||||||
user_error("ModelAsController::getNestedController() returned bad object type '" .
|
user_error("ModelAsController::getNestedController() returned bad object type '" .
|
||||||
get_class($result)."'", E_USER_WARNING);
|
get_class($result)."'", E_USER_WARNING);
|
||||||
}
|
}
|
||||||
} catch(SS_HTTPResponse_Exception $responseException) {
|
} catch(HTTPResponse_Exception $responseException) {
|
||||||
$result = $responseException->getResponse();
|
$result = $responseException->getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
|
|
||||||
class OldPageRedirector extends Extension {
|
class OldPageRedirector extends Extension {
|
||||||
@ -16,8 +16,8 @@ class OldPageRedirector extends Extension {
|
|||||||
* On every URL that generates a 404, we'll capture it here and see if we can
|
* On every URL that generates a 404, we'll capture it here and see if we can
|
||||||
* find an old URL that it should be redirecting to.
|
* find an old URL that it should be redirecting to.
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request The request object
|
* @param HTTPRequest $request The request object
|
||||||
* @throws SS_HTTPResponse_Exception
|
* @throws HTTPResponse_Exception
|
||||||
*/
|
*/
|
||||||
public function onBeforeHTTPError404($request) {
|
public function onBeforeHTTPError404($request) {
|
||||||
// We need to get the URL ourselves because $request->allParams() only has a max of 4 params
|
// We need to get the URL ourselves because $request->allParams() only has a max of 4 params
|
||||||
@ -34,13 +34,13 @@ class OldPageRedirector extends Extension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($page && $cleanPage != $cleanURL) {
|
if ($page && $cleanPage != $cleanURL) {
|
||||||
$res = new SS_HTTPResponse();
|
$res = new HTTPResponse();
|
||||||
$res->redirect(
|
$res->redirect(
|
||||||
Controller::join_links(
|
Controller::join_links(
|
||||||
$page,
|
$page,
|
||||||
($getvars) ? '?' . http_build_query($getvars) : null
|
($getvars) ? '?' . http_build_query($getvars) : null
|
||||||
), 301);
|
), 301);
|
||||||
throw new SS_HTTPResponse_Exception($res);
|
throw new HTTPResponse_Exception($res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@ namespace SilverStripe\CMS\Controllers;
|
|||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\Deprecation;
|
use SilverStripe\Dev\Deprecation;
|
||||||
@ -120,7 +120,7 @@ class RootURLController extends Controller {
|
|||||||
self::$cached_homepage_link = null;
|
self::$cached_homepage_link = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function beforeHandleRequest(SS_HTTPRequest $request, DataModel $model) {
|
protected function beforeHandleRequest(HTTPRequest $request, DataModel $model) {
|
||||||
parent::beforeHandleRequest($request, $model);
|
parent::beforeHandleRequest($request, $model);
|
||||||
|
|
||||||
self::$is_at_root = true;
|
self::$is_at_root = true;
|
||||||
@ -138,11 +138,11 @@ class RootURLController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @param DataModel|null $model
|
* @param DataModel|null $model
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function handleRequest(SS_HTTPRequest $request, DataModel $model = null) {
|
public function handleRequest(HTTPRequest $request, DataModel $model = null) {
|
||||||
self::$is_at_root = true;
|
self::$is_at_root = true;
|
||||||
$this->beforeHandleRequest($request, $model);
|
$this->beforeHandleRequest($request, $model);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ namespace SilverStripe\CMS\Forms;
|
|||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\Controller;
|
use SilverStripe\Control\Controller;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Forms\TextField;
|
use SilverStripe\Forms\TextField;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
@ -49,7 +49,7 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function suggest($request) {
|
public function suggest($request) {
|
||||||
|
@ -9,8 +9,8 @@ use SilverStripe\ORM\Versioning\Versioned;
|
|||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\CMS\Controllers\ModelAsController;
|
use SilverStripe\CMS\Controllers\ModelAsController;
|
||||||
use SilverStripe\View\Requirements;
|
use SilverStripe\View\Requirements;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use SilverStripe\Forms\DropdownField;
|
use SilverStripe\Forms\DropdownField;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
@ -73,13 +73,13 @@ class ErrorPage extends Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a {@link SS_HTTPResponse} to response to a HTTP error code if an
|
* Get a {@link HTTPResponse} to response to a HTTP error code if an
|
||||||
* {@link ErrorPage} for that code is present. First tries to serve it
|
* {@link ErrorPage} for that code is present. First tries to serve it
|
||||||
* through the standard SilverStripe request method. Falls back to a static
|
* through the standard SilverStripe request method. Falls back to a static
|
||||||
* file generated when the user hit's save and publish in the CMS
|
* file generated when the user hit's save and publish in the CMS
|
||||||
*
|
*
|
||||||
* @param int $statusCode
|
* @param int $statusCode
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public static function response_for($statusCode) {
|
public static function response_for($statusCode) {
|
||||||
// first attempt to dynamically generate the error page
|
// first attempt to dynamically generate the error page
|
||||||
@ -95,7 +95,7 @@ class ErrorPage extends Page {
|
|||||||
|
|
||||||
return ModelAsController::controller_for($errorPage)
|
return ModelAsController::controller_for($errorPage)
|
||||||
->handleRequest(
|
->handleRequest(
|
||||||
new SS_HTTPRequest('GET', ''),
|
new HTTPRequest('GET', ''),
|
||||||
DataModel::inst()
|
DataModel::inst()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ class ErrorPage extends Page {
|
|||||||
// then fall back on a cached version
|
// then fall back on a cached version
|
||||||
$content = self::get_content_for_errorcode($statusCode);
|
$content = self::get_content_for_errorcode($statusCode);
|
||||||
if($content) {
|
if($content) {
|
||||||
$response = new SS_HTTPResponse();
|
$response = new HTTPResponse();
|
||||||
$response->setStatusCode($statusCode);
|
$response->setStatusCode($statusCode);
|
||||||
$response->setBody($content);
|
$response->setBody($content);
|
||||||
return $response;
|
return $response;
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
namespace SilverStripe\CMS\Model;
|
namespace SilverStripe\CMS\Model;
|
||||||
|
|
||||||
use SilverStripe\ORM\DataModel;
|
use SilverStripe\ORM\DataModel;
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Control\SS_HTTPResponse;
|
use SilverStripe\Control\HTTPResponse;
|
||||||
use Page_Controller;
|
use Page_Controller;
|
||||||
|
|
||||||
|
|
||||||
@ -17,13 +17,13 @@ class ErrorPage_Controller extends Page_Controller
|
|||||||
* Overload the provided {@link Controller::handleRequest()} to append the
|
* Overload the provided {@link Controller::handleRequest()} to append the
|
||||||
* correct status code post request since otherwise permission related error
|
* correct status code post request since otherwise permission related error
|
||||||
* pages such as 401 and 403 pages won't be rendered due to
|
* pages such as 401 and 403 pages won't be rendered due to
|
||||||
* {@link SS_HTTPResponse::isFinished() ignoring the response body.
|
* {@link HTTPResponse::isFinished() ignoring the response body.
|
||||||
*
|
*
|
||||||
* @param SS_HTTPRequest $request
|
* @param HTTPRequest $request
|
||||||
* @param DataModel $model
|
* @param DataModel $model
|
||||||
* @return SS_HTTPResponse
|
* @return HTTPResponse
|
||||||
*/
|
*/
|
||||||
public function handleRequest(SS_HTTPRequest $request, DataModel $model = null)
|
public function handleRequest(HTTPRequest $request, DataModel $model = null)
|
||||||
{
|
{
|
||||||
$response = parent::handleRequest($request, $model);
|
$response = parent::handleRequest($request, $model);
|
||||||
$response->setStatusCode($this->ErrorCode);
|
$response->setStatusCode($this->ErrorCode);
|
||||||
|
@ -3,7 +3,7 @@ namespace SilverStripe\CMS\Model;
|
|||||||
|
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\View\Parsers\SS_HTMLValue;
|
use SilverStripe\View\Parsers\HTMLValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper object for extracting information about links.
|
* A helper object for extracting information about links.
|
||||||
@ -15,7 +15,7 @@ class SiteTreeLinkTracking_Parser
|
|||||||
* Finds the links that are of interest for the link tracking automation. Checks for brokenness and attaches
|
* Finds the links that are of interest for the link tracking automation. Checks for brokenness and attaches
|
||||||
* extracted metadata so consumers can decide what to do with the DOM element (provided as DOMReference).
|
* extracted metadata so consumers can decide what to do with the DOM element (provided as DOMReference).
|
||||||
*
|
*
|
||||||
* @param SS_HTMLValue $htmlValue Object to parse the links from.
|
* @param HTMLValue $htmlValue Object to parse the links from.
|
||||||
* @return array Associative array containing found links with the following field layout:
|
* @return array Associative array containing found links with the following field layout:
|
||||||
* Type: string, name of the link type
|
* Type: string, name of the link type
|
||||||
* Target: any, a reference to the target object, depends on the Type
|
* Target: any, a reference to the target object, depends on the Type
|
||||||
@ -23,7 +23,7 @@ class SiteTreeLinkTracking_Parser
|
|||||||
* DOMReference: DOMElement, reference to the link to apply changes.
|
* DOMReference: DOMElement, reference to the link to apply changes.
|
||||||
* Broken: boolean, a flag highlighting whether the link should be treated as broken.
|
* Broken: boolean, a flag highlighting whether the link should be treated as broken.
|
||||||
*/
|
*/
|
||||||
public function process(SS_HTMLValue $htmlValue)
|
public function process(HTMLValue $htmlValue)
|
||||||
{
|
{
|
||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
|
@ -5,11 +5,11 @@ namespace SilverStripe\CMS\Reports;
|
|||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Forms\CheckboxField;
|
use SilverStripe\Forms\CheckboxField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
class BrokenFilesReport extends SS_Report {
|
class BrokenFilesReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENFILES',"Pages with broken files");
|
return _t('SideReport.BROKENFILES',"Pages with broken files");
|
||||||
|
@ -11,12 +11,12 @@ use SilverStripe\Forms\FieldList;
|
|||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\ORM\ArrayList;
|
use SilverStripe\ORM\ArrayList;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content side-report listing pages with broken links
|
* Content side-report listing pages with broken links
|
||||||
*/
|
*/
|
||||||
class BrokenLinksReport extends SS_Report {
|
class BrokenLinksReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
|
return _t('BrokenLinksReport.BROKENLINKS',"Broken links report");
|
||||||
|
@ -7,9 +7,9 @@ use SilverStripe\Forms\CheckboxField;
|
|||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class BrokenRedirectorPagesReport extends SS_Report {
|
class BrokenRedirectorPagesReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages');
|
return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages');
|
||||||
|
@ -7,9 +7,9 @@ use SilverStripe\Forms\CheckboxField;
|
|||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\ORM\DB;
|
use SilverStripe\ORM\DB;
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class BrokenVirtualPagesReport extends SS_Report {
|
class BrokenVirtualPagesReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages');
|
return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages');
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
namespace SilverStripe\CMS\Reports;
|
namespace SilverStripe\CMS\Reports;
|
||||||
|
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class EmptyPagesReport extends SS_Report {
|
class EmptyPagesReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('SideReport.EMPTYPAGES',"Pages with no content");
|
return _t('SideReport.EMPTYPAGES',"Pages with no content");
|
||||||
|
@ -4,9 +4,9 @@ namespace SilverStripe\CMS\Reports;
|
|||||||
|
|
||||||
use SilverStripe\ORM\FieldType\DBDatetime;
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
use SilverStripe\ORM\DataObject;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
|
|
||||||
class RecentlyEditedReport extends SS_Report {
|
class RecentlyEditedReport extends Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks");
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace SilverStripe\CMS\Search;
|
namespace SilverStripe\CMS\Search;
|
||||||
|
|
||||||
use SilverStripe\Control\SS_HTTPRequest;
|
use SilverStripe\Control\HTTPRequest;
|
||||||
use SilverStripe\Core\Extension;
|
use SilverStripe\Core\Extension;
|
||||||
use SilverStripe\Forms\TextField;
|
use SilverStripe\Forms\TextField;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
@ -45,7 +45,7 @@ class ContentControllerSearchExtension extends Extension {
|
|||||||
*
|
*
|
||||||
* @param array $data The raw request data submitted by user
|
* @param array $data The raw request data submitted by user
|
||||||
* @param SearchForm $form The form instance that was submitted
|
* @param SearchForm $form The form instance that was submitted
|
||||||
* @param SS_HTTPRequest $request Request generated for this action
|
* @param HTTPRequest $request Request generated for this action
|
||||||
*/
|
*/
|
||||||
public function results($data, $form, $request) {
|
public function results($data, $form, $request) {
|
||||||
$data = array(
|
$data = array(
|
||||||
|
@ -9,14 +9,14 @@ use SilverStripe\CMS\Controllers\CMSMain;
|
|||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Admin\CMSBatchActionHandler;
|
use SilverStripe\Admin\CMSBatchActionHandler;
|
||||||
use SilverStripe\SiteConfig\SiteConfig;
|
use SilverStripe\SiteConfig\SiteConfig;
|
||||||
use SilverStripe\Core\SS_Cache;
|
use SilverStripe\Core\Cache;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
use SilverStripe\Core\ClassInfo;
|
use SilverStripe\Core\ClassInfo;
|
||||||
use SilverStripe\Dev\TestOnly;
|
use SilverStripe\Dev\TestOnly;
|
||||||
use SilverStripe\Forms\FieldList;
|
use SilverStripe\Forms\FieldList;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\CSSContentParser;
|
use SilverStripe\Dev\CSSContentParser;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testSiteTreeHints() {
|
function testSiteTreeHints() {
|
||||||
$cache = SS_Cache::factory('CMSMain_SiteTreeHints');
|
$cache = Cache::factory('CMSMain_SiteTreeHints');
|
||||||
// Login as user with root creation privileges
|
// Login as user with root creation privileges
|
||||||
$user = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser');
|
$user = $this->objFromFixture('SilverStripe\\Security\\Member', 'rootedituser');
|
||||||
$user->logIn();
|
$user->logIn();
|
||||||
@ -443,7 +443,7 @@ class CMSMainTest extends FunctionalTest {
|
|||||||
$id = 'new-Member-0';
|
$id = 'new-Member-0';
|
||||||
$member = $controller->getNewItem($id, false);
|
$member = $controller->getNewItem($id, false);
|
||||||
$this->fail('Should not be able to create a Member object');
|
$this->fail('Should not be able to create a Member object');
|
||||||
} catch (SS_HTTPResponse_Exception $e) {
|
} catch (HTTPResponse_Exception $e) {
|
||||||
$this->assertEquals($controller->getResponse()->getStatusCode(), 302);
|
$this->assertEquals($controller->getResponse()->getStatusCode(), 302);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ class ContentControllerPermissionsTest extends FunctionalTest {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$response = $this->get('/testpage/?stage=Stage');
|
$response = $this->get('/testpage/?stage=Stage');
|
||||||
} catch(SS_HTTPResponse_Exception $responseException) {
|
} catch(HTTPResponse_Exception $responseException) {
|
||||||
$response = $responseException->getResponse();
|
$response = $responseException->getResponse();
|
||||||
}
|
}
|
||||||
// should redirect to login
|
// should redirect to login
|
||||||
|
@ -6,7 +6,7 @@ use SilverStripe\CMS\Model\SiteTree;
|
|||||||
use SilverStripe\CMS\Controllers\ContentController;
|
use SilverStripe\CMS\Controllers\ContentController;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Control\Director;
|
use SilverStripe\Control\Director;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -108,7 +108,7 @@ class ContentControllerTest extends FunctionalTest {
|
|||||||
$this->logInWithPermission('EDITOR');
|
$this->logInWithPermission('EDITOR');
|
||||||
try {
|
try {
|
||||||
$response = $this->get('/contact/?stage=Stage');
|
$response = $this->get('/contact/?stage=Stage');
|
||||||
} catch(SS_HTTPResponse_Exception $responseException) {
|
} catch(HTTPResponse_Exception $responseException) {
|
||||||
$response = $responseException->getResponse();
|
$response = $responseException->getResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,10 @@ class ErrorPageTest extends FunctionalTest {
|
|||||||
/* We have body text from the error page */
|
/* We have body text from the error page */
|
||||||
$this->assertNotNull($response->getBody(), 'We have body text from the error page');
|
$this->assertNotNull($response->getBody(), 'We have body text from the error page');
|
||||||
|
|
||||||
/* Status code of the SS_HTTPResponse for error page is "404" */
|
/* Status code of the HTTPResponse for error page is "404" */
|
||||||
$this->assertEquals($response->getStatusCode(), '404', 'Status code of the SS_HTTPResponse for error page is "404"');
|
$this->assertEquals($response->getStatusCode(), '404', 'Status code of the HTTPResponse for error page is "404"');
|
||||||
|
|
||||||
/* Status message of the SS_HTTPResponse for error page is "Not Found" */
|
/* Status message of the HTTPResponse for error page is "Not Found" */
|
||||||
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
|
$this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use SilverStripe\ORM\Versioning\Versioned;
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
use SilverStripe\Security\Member;
|
use SilverStripe\Security\Member;
|
||||||
use SilverStripe\CMS\Model\SiteTree;
|
use SilverStripe\CMS\Model\SiteTree;
|
||||||
use SilverStripe\Control\SS_HTTPResponse_Exception;
|
use SilverStripe\Control\HTTPResponse_Exception;
|
||||||
use SilverStripe\Core\Config\Config;
|
use SilverStripe\Core\Config\Config;
|
||||||
use SilverStripe\Dev\FunctionalTest;
|
use SilverStripe\Dev\FunctionalTest;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ class SiteTreePermissionsTest extends FunctionalTest {
|
|||||||
// should be prompted for a login
|
// should be prompted for a login
|
||||||
try {
|
try {
|
||||||
$response = $this->get($page->URLSegment . '?stage=Stage');
|
$response = $this->get($page->URLSegment . '?stage=Stage');
|
||||||
} catch(SS_HTTPResponse_Exception $responseException) {
|
} catch(HTTPResponse_Exception $responseException) {
|
||||||
$response = $responseException->getResponse();
|
$response = $responseException->getResponse();
|
||||||
}
|
}
|
||||||
$this->assertEquals($response->getStatusCode(), '302');
|
$this->assertEquals($response->getStatusCode(), '302');
|
||||||
|
@ -9,7 +9,7 @@ use SilverStripe\CMS\Model\VirtualPage;
|
|||||||
use SilverStripe\CMS\Reports\BrokenVirtualPagesReport;
|
use SilverStripe\CMS\Reports\BrokenVirtualPagesReport;
|
||||||
use SilverStripe\CMS\Model\RedirectorPage;
|
use SilverStripe\CMS\Model\RedirectorPage;
|
||||||
use SilverStripe\CMS\Reports\BrokenRedirectorPagesReport;
|
use SilverStripe\CMS\Reports\BrokenRedirectorPagesReport;
|
||||||
use SilverStripe\Reports\SS_Report;
|
use SilverStripe\Reports\Report;
|
||||||
use SilverStripe\Assets\File;
|
use SilverStripe\Assets\File;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
|
|
||||||
// Retrieve the broken links side report.
|
// Retrieve the broken links side report.
|
||||||
|
|
||||||
$reports = SS_Report::get_reports();
|
$reports = Report::get_reports();
|
||||||
$brokenLinksReport = null;
|
$brokenLinksReport = null;
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
if($report instanceof BrokenLinksReport) {
|
if($report instanceof BrokenLinksReport) {
|
||||||
@ -155,7 +155,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
|
|
||||||
// Retrieve the broken files side report.
|
// Retrieve the broken files side report.
|
||||||
|
|
||||||
$reports = SS_Report::get_reports();
|
$reports = Report::get_reports();
|
||||||
$brokenFilesReport = null;
|
$brokenFilesReport = null;
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
if($report instanceof BrokenFilesReport) {
|
if($report instanceof BrokenFilesReport) {
|
||||||
@ -221,7 +221,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
|
|
||||||
// Retrieve the broken virtual pages side report.
|
// Retrieve the broken virtual pages side report.
|
||||||
|
|
||||||
$reports = SS_Report::get_reports();
|
$reports = Report::get_reports();
|
||||||
$brokenVirtualPagesReport = null;
|
$brokenVirtualPagesReport = null;
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
if($report instanceof BrokenVirtualPagesReport) {
|
if($report instanceof BrokenVirtualPagesReport) {
|
||||||
@ -289,7 +289,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
|
|
||||||
// Retrieve the broken redirector pages side report.
|
// Retrieve the broken redirector pages side report.
|
||||||
|
|
||||||
$reports = SS_Report::get_reports();
|
$reports = Report::get_reports();
|
||||||
$brokenRedirectorPagesReport = null;
|
$brokenRedirectorPagesReport = null;
|
||||||
foreach($reports as $report) {
|
foreach($reports as $report) {
|
||||||
if($report instanceof BrokenRedirectorPagesReport) {
|
if($report instanceof BrokenRedirectorPagesReport) {
|
||||||
|
Loading…
Reference in New Issue
Block a user