mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1534 from open-sausages/pulls/4.0/namespace-orm
API Update for new SilverStripe\ORM namespace
This commit is contained in:
commit
d208a6f511
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Publish items batch action.
|
* Publish items batch action.
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\Filesystem\Storage\AssetNameGenerator;
|
use SilverStripe\Filesystem\Storage\AssetNameGenerator;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AssetAdmin is the 'file store' section of the CMS.
|
* AssetAdmin is the 'file store' section of the CMS.
|
||||||
@ -171,7 +175,7 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
|
|||||||
'Size' => _t('AssetAdmin.SIZE', 'Size'),
|
'Size' => _t('AssetAdmin.SIZE', 'Size'),
|
||||||
));
|
));
|
||||||
$columns->setFieldCasting(array(
|
$columns->setFieldCasting(array(
|
||||||
'Created' => 'SS_Datetime->Nice'
|
'Created' => 'DBDatetime->Nice'
|
||||||
));
|
));
|
||||||
$gridField->setAttribute(
|
$gridField->setAttribute(
|
||||||
'data-url-folder-template',
|
'data-url-folder-template',
|
||||||
@ -484,7 +488,7 @@ class AssetAdmin extends LeftAndMain implements PermissionProvider{
|
|||||||
|
|
||||||
// check addchildren permissions
|
// check addchildren permissions
|
||||||
if(
|
if(
|
||||||
singleton($class)->hasExtension('Hierarchy')
|
singleton($class)->hasExtension('SilverStripe\ORM\Hierarchy\Hierarchy')
|
||||||
&& isset($data['ParentID'])
|
&& isset($data['ParentID'])
|
||||||
&& is_numeric($data['ParentID'])
|
&& is_numeric($data['ParentID'])
|
||||||
&& $data['ParentID']
|
&& $data['ParentID']
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
use SilverStripe\Model\FieldType\DBHTMLText;
|
|
||||||
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\HiddenClass;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\DataList;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The main "content" area of the CMS.
|
* The main "content" area of the CMS.
|
||||||
@ -779,8 +787,8 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr
|
|||||||
|
|
||||||
$columns->setDisplayFields($fields);
|
$columns->setDisplayFields($fields);
|
||||||
$columns->setFieldCasting(array(
|
$columns->setFieldCasting(array(
|
||||||
'Created' => 'SS_Datetime->Ago',
|
'Created' => 'DBDatetime->Ago',
|
||||||
'LastEdited' => 'SS_Datetime->FormatFromSettings',
|
'LastEdited' => 'DBDatetime->FormatFromSettings',
|
||||||
'getTreeTitle' => 'HTMLText'
|
'getTreeTitle' => 'HTMLText'
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\ValidationException;
|
||||||
|
|
||||||
class CMSPageAddController extends CMSPageEditController {
|
class CMSPageAddController extends CMSPageEditController {
|
||||||
|
|
||||||
private static $url_segment = 'pages/add';
|
private static $url_segment = 'pages/add';
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage controllers
|
* @subpackage controllers
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for filtering the subtree for certain node statuses.
|
* Base class for filtering the subtree for certain node statuses.
|
||||||
*
|
*
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\Model\FieldType\DBVarchar;
|
use SilverStripe\ORM\DataObject;
|
||||||
use SilverStripe\Model\FieldType\DBHTMLText;
|
use SilverStripe\ORM\DataModel;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||||
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The most common kind of controller; effectively a controller linked to a {@link DataObject}.
|
* The most common kind of controller; effectively a controller linked to a {@link DataObject}.
|
||||||
@ -313,7 +320,7 @@ HTML;
|
|||||||
} else {
|
} else {
|
||||||
if($date = Versioned::current_archived_date()) {
|
if($date = Versioned::current_archived_date()) {
|
||||||
Requirements::css(CMS_DIR . '/client/dist/styles/SilverStripeNavigator.css');
|
Requirements::css(CMS_DIR . '/client/dist/styles/SilverStripeNavigator.css');
|
||||||
$dateObj = Datetime::create($date, null);
|
$dateObj = DBField::create_field('Datetime', $date);
|
||||||
// $dateObj->setVal($date);
|
// $dateObj->setVal($date);
|
||||||
return "<div id=\"SilverStripeNavigatorMessage\">". _t('ContentController.ARCHIVEDSITEFROM') ."<br>" . $dateObj->Nice() . "</div>";
|
return "<div id=\"SilverStripeNavigatorMessage\">". _t('ContentController.ARCHIVEDSITEFROM') ."<br>" . $dateObj->Nice() . "</div>";
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decorates {@see File} with ErrorPage support
|
* Decorates {@see File} with ErrorPage support
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataModel;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ModelAsController deals with mapping the initial request to the first {@link SiteTree}/{@link ContentController}
|
* ModelAsController deals with mapping the initial request to the first {@link SiteTree}/{@link ContentController}
|
||||||
* pair, which are then used to handle the request.
|
* pair, which are then used to handle the request.
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Queries\SQLSelect;
|
||||||
|
|
||||||
class OldPageRedirector extends Extension {
|
class OldPageRedirector extends Extension {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataModel;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage control
|
* @subpackage control
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
use SilverStripe\Model\FieldType\DBField;
|
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class representing links to different views of a record
|
* Utility class representing links to different views of a record
|
||||||
@ -191,7 +196,7 @@ abstract class SilverStripeNavigatorItem extends ViewableData {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isArchived() {
|
public function isArchived() {
|
||||||
if(!$this->record->hasExtension('Versioned')) return false;
|
if(!$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')) return false;
|
||||||
|
|
||||||
if(!isset($this->record->_cached_isArchived)) {
|
if(!isset($this->record->_cached_isArchived)) {
|
||||||
$baseClass = $this->record->baseClass();
|
$baseClass = $this->record->baseClass();
|
||||||
@ -282,7 +287,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem {
|
|||||||
|
|
||||||
public function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('Versioned')
|
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
||||||
&& $this->getDraftPage()
|
&& $this->getDraftPage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
@ -333,7 +338,7 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem {
|
|||||||
|
|
||||||
public function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('Versioned')
|
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
||||||
&& $this->getLivePage()
|
&& $this->getLivePage()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
@ -383,7 +388,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem {
|
|||||||
|
|
||||||
public function canView($member = null) {
|
public function canView($member = null) {
|
||||||
return (
|
return (
|
||||||
$this->record->hasExtension('Versioned')
|
$this->record->hasExtension('SilverStripe\ORM\Versioning\Versioned')
|
||||||
&& $this->isArchived()
|
&& $this->isArchived()
|
||||||
// Don't follow redirects in preview, they break the CMS editing form
|
// Don't follow redirects in preview, they break the CMS editing form
|
||||||
&& !($this->record instanceof RedirectorPage)
|
&& !($this->record instanceof RedirectorPage)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to edit the SiteTree->URLSegment property, and suggest input based on the serverside rules
|
* Used to edit the SiteTree->URLSegment property, and suggest input based on the serverside rules
|
||||||
* defined through {@link SiteTree->generateURLSegment()} and {@link URLSegmentFilter}.
|
* defined through {@link SiteTree->generateURLSegment()} and {@link URLSegmentFilter}.
|
||||||
@ -9,7 +11,6 @@
|
|||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage forms
|
* @subpackage forms
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SiteTreeURLSegmentField extends TextField {
|
class SiteTreeURLSegmentField extends TextField {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,6 +74,7 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $string The secondary text to show
|
* @param string $string The secondary text to show
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setHelpText($string){
|
public function setHelpText($string){
|
||||||
$this->helpText = $string;
|
$this->helpText = $string;
|
||||||
@ -88,7 +90,8 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param the url that prefixes the page url segment field
|
* @param string $url the url that prefixes the page url segment field
|
||||||
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setURLPrefix($url){
|
public function setURLPrefix($url){
|
||||||
$this->urlPrefix = $url;
|
$this->urlPrefix = $url;
|
||||||
@ -96,7 +99,7 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the url prefixes the page url segment field to show in template
|
* @return string the url prefixes the page url segment field to show in template
|
||||||
*/
|
*/
|
||||||
public function getURLPrefix(){
|
public function getURLPrefix(){
|
||||||
return $this->urlPrefix;
|
return $this->urlPrefix;
|
||||||
@ -107,7 +110,7 @@ class SiteTreeURLSegmentField extends TextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Indicator for UI to respond to changes accurately,
|
* @return string Indicator for UI to respond to changes accurately,
|
||||||
* and auto-update the field value if changes to the default occur.
|
* and auto-update the field value if changes to the default occur.
|
||||||
* Does not set the field default value.
|
* Does not set the field default value.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface lets us set up objects that will tell us what the current page is.
|
* This interface lets us set up objects that will tell us what the current page is.
|
||||||
* @package cms
|
* @package cms
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\Filesystem\Storage\GeneratedAssetHandler;
|
use SilverStripe\Filesystem\Storage\GeneratedAssetHandler;
|
||||||
|
use SilverStripe\ORM\DataModel;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ErrorPage holds the content for the page of an error response.
|
* ErrorPage holds the content for the page of an error response.
|
||||||
* Renders the page on each publish action into a static HTML file
|
* Renders the page on each publish action into a static HTML file
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A redirector page redirects when the page is visited.
|
* A redirector page redirects when the page is visited.
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\Hierarchy\Hierarchy;
|
||||||
|
use SilverStripe\ORM\ManyManyList;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataList;
|
||||||
|
use SilverStripe\ORM\HiddenClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Basic data-object representing all pages within the site tree. All page types that live within the hierarchy should
|
* Basic data-object representing all pages within the site tree. All page types that live within the hierarchy should
|
||||||
* inherit from this. In addition, it contains a number of static methods for querying the site tree and working with
|
* inherit from this. In addition, it contains a number of static methods for querying the site tree and working with
|
||||||
@ -142,8 +152,6 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
|
|
||||||
private static $casting = array(
|
private static $casting = array(
|
||||||
"Breadcrumbs" => "HTMLText",
|
"Breadcrumbs" => "HTMLText",
|
||||||
"LastEdited" => "SS_Datetime",
|
|
||||||
"Created" => "SS_Datetime",
|
|
||||||
'Link' => 'Text',
|
'Link' => 'Text',
|
||||||
'RelativeLink' => 'Text',
|
'RelativeLink' => 'Text',
|
||||||
'AbsoluteLink' => 'Text',
|
'AbsoluteLink' => 'Text',
|
||||||
@ -188,8 +196,8 @@ class SiteTree extends DataObject implements PermissionProvider,i18nEntityProvid
|
|||||||
private static $description = 'Generic content page';
|
private static $description = 'Generic content page';
|
||||||
|
|
||||||
private static $extensions = array(
|
private static $extensions = array(
|
||||||
"Hierarchy",
|
'SilverStripe\ORM\Hierarchy\Hierarchy',
|
||||||
"Versioned",
|
'SilverStripe\ORM\Versioning\Versioned',
|
||||||
"SiteTreeLinkTracking"
|
"SiteTreeLinkTracking"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plug-ins for additional functionality in your SiteTree classes.
|
* Plug-ins for additional functionality in your SiteTree classes.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\ManyManyList;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension applied to {@see File} object to track links to {@see SiteTree} records.
|
* Extension applied to {@see File} object to track links to {@see SiteTree} records.
|
||||||
*
|
*
|
||||||
@ -109,7 +114,7 @@ class SiteTreeFileExtension extends DataExtension {
|
|||||||
*/
|
*/
|
||||||
public function onAfterDelete() {
|
public function onAfterDelete() {
|
||||||
// Skip live stage
|
// Skip live stage
|
||||||
if(\Versioned::get_stage() === Versioned::LIVE) {
|
if(Versioned::get_stage() === Versioned::LIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataQuery;
|
||||||
|
use SilverStripe\ORM\DataList;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @todo Cleanup, refactor, test this class
|
* @todo Cleanup, refactor, test this class
|
||||||
*
|
*
|
||||||
|
@ -5,7 +5,13 @@
|
|||||||
* @subpackage model
|
* @subpackage model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use SilverStripe\Model\FieldType\DBHTMLText;
|
|
||||||
|
use SilverStripe\ORM\ManyManyList;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\FieldType\DBHTMLText;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds tracking of links in any HTMLText fields which reference SiteTree or File items.
|
* Adds tracking of links in any HTMLText fields which reference SiteTree or File items.
|
||||||
@ -195,7 +201,7 @@ class SiteTreeLinkTracking extends DataExtension {
|
|||||||
*/
|
*/
|
||||||
public function augmentSyncLinkTracking() {
|
public function augmentSyncLinkTracking() {
|
||||||
// Skip live tracking
|
// Skip live tracking
|
||||||
if(\Versioned::get_stage() == \Versioned::LIVE) {
|
if(Versioned::get_stage() == Versioned::LIVE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly.
|
* Virtual Page creates an instance of a page, with the same fields that the original page had, but readonly.
|
||||||
* This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content
|
* This allows you can have a page in mulitple places in the site structure, with different children without duplicating the content
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage reports
|
* @subpackage reports
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Content side-report listing pages with broken links
|
* Content side-report listing pages with broken links
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage content
|
* @subpackage content
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BrokenLinksReport extends SS_Report {
|
class BrokenLinksReport extends SS_Report {
|
||||||
|
|
||||||
public function title() {
|
public function title() {
|
||||||
@ -100,7 +103,7 @@ class BrokenLinksReport extends SS_Report {
|
|||||||
),
|
),
|
||||||
"LastEdited" => array(
|
"LastEdited" => array(
|
||||||
"title" => $dateTitle,
|
"title" => $dateTitle,
|
||||||
'casting' => 'SS_Datetime->Full'
|
'casting' => 'DBDatetime->Full'
|
||||||
),
|
),
|
||||||
"BrokenReason" => array(
|
"BrokenReason" => array(
|
||||||
"title" => _t('BrokenLinksReport.ColumnProblemType', "Problem type")
|
"title" => _t('BrokenLinksReport.ColumnProblemType', "Problem type")
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage reports
|
* @subpackage reports
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage reports
|
* @subpackage reports
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage reports
|
* @subpackage reports
|
||||||
@ -19,7 +22,7 @@ class RecentlyEditedReport extends SS_Report {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function sourceRecords($params = null) {
|
public function sourceRecords($params = null) {
|
||||||
$threshold = strtotime('-14 days', SS_Datetime::now()->Format('U'));
|
$threshold = strtotime('-14 days', DBDatetime::now()->Format('U'));
|
||||||
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
|
return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extension to provide a search interface when applied to ContentController
|
* Extension to provide a search interface when applied to ContentController
|
||||||
*
|
*
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage search
|
* @subpackage search
|
||||||
*/
|
*/
|
||||||
use SilverStripe\Model\FieldType\DBField;
|
|
||||||
class ContentControllerSearchExtension extends Extension {
|
class ContentControllerSearchExtension extends Extension {
|
||||||
private static $allowed_actions = array(
|
private static $allowed_actions = array(
|
||||||
'SearchForm',
|
'SearchForm',
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard basic search form which conducts a fulltext search on all {@link SiteTree}
|
* Standard basic search form which conducts a fulltext search on all {@link SiteTree}
|
||||||
* objects.
|
* objects.
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataList;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rewrites plain internal HTML links into shortcode form, using existing link tracking information.
|
* Rewrites plain internal HTML links into shortcode form, using existing link tracking information.
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
use SilverStripe\Model\FieldType\DBDatetime;
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\ArrayList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identify "orphaned" pages which point to a parent
|
* Identify "orphaned" pages which point to a parent
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tasks
|
* @subpackage tasks
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tasks
|
* @subpackage tasks
|
||||||
|
@ -8,7 +8,9 @@ use SilverStripe\BehatExtension\Context\SilverStripeContext,
|
|||||||
SilverStripe\BehatExtension\Context\FixtureContext,
|
SilverStripe\BehatExtension\Context\FixtureContext,
|
||||||
SilverStripe\Framework\Test\Behaviour\CmsFormsContext,
|
SilverStripe\Framework\Test\Behaviour\CmsFormsContext,
|
||||||
SilverStripe\Framework\Test\Behaviour\CmsUiContext,
|
SilverStripe\Framework\Test\Behaviour\CmsUiContext,
|
||||||
SilverStripe\Cms\Test\Behaviour;
|
SilverStripe\Cms\Test\Behaviour,
|
||||||
|
SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Features context
|
* Features context
|
||||||
@ -41,7 +43,7 @@ class FeatureContext extends \SilverStripe\Framework\Test\Behaviour\FeatureConte
|
|||||||
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
|
$blueprint = \Injector::inst()->create('FixtureBlueprint', $class);
|
||||||
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
|
$blueprint->addCallback('afterCreate', function($obj, $identifier, &$data, &$fixtures) {
|
||||||
/** @var \SiteTree $obj */
|
/** @var \SiteTree $obj */
|
||||||
$obj->copyVersionToStage(\Versioned::DRAFT, \Versioned::LIVE);
|
$obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
});
|
});
|
||||||
$factory->define($class, $blueprint);
|
$factory->define($class, $blueprint);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,9 @@ use Behat\Behat\Context\ClosuredContextInterface,
|
|||||||
Behat\Behat\Exception\PendingException,
|
Behat\Behat\Exception\PendingException,
|
||||||
Behat\Mink\Driver\Selenium2Driver,
|
Behat\Mink\Driver\Selenium2Driver,
|
||||||
Behat\Gherkin\Node\PyStringNode,
|
Behat\Gherkin\Node\PyStringNode,
|
||||||
Behat\Gherkin\Node\TableNode;
|
Behat\Gherkin\Node\TableNode,
|
||||||
|
SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Context used to create fixtures in the SilverStripe ORM.
|
* Context used to create fixtures in the SilverStripe ORM.
|
||||||
@ -39,7 +41,7 @@ class FixtureContext extends \SilverStripe\BehatExtension\Context\FixtureContext
|
|||||||
$obj = $this->fixtureFactory->createObject($class, $id, $fields);
|
$obj = $this->fixtureFactory->createObject($class, $id, $fields);
|
||||||
}
|
}
|
||||||
$obj->write();
|
$obj->write();
|
||||||
$obj->copyVersionToStage(\Versioned::DRAFT, \Versioned::LIVE);
|
$obj->copyVersionToStage(Versioned::DRAFT, Versioned::LIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\SS_List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@see AssetAdmin}
|
* Tests {@see AssetAdmin}
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests CMS Specific subclasses of {@see CMSBatchAction}
|
* Tests CMS Specific subclasses of {@see CMSBatchAction}
|
||||||
|
@ -1,4 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\HiddenClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CMSPageHistoryControllerTest extends FunctionalTest {
|
class CMSPageHistoryControllerTest extends FunctionalTest {
|
||||||
|
|
||||||
protected static $fixture_file = 'CMSPageHistoryControllerTest.yml';
|
protected static $fixture_file = 'CMSPageHistoryControllerTest.yml';
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
class CMSSiteTreeFilterTest extends SapphireTest {
|
class CMSSiteTreeFilterTest extends SapphireTest {
|
||||||
|
|
||||||
protected static $fixture_file = 'CMSSiteTreeFilterTest.yml';
|
protected static $fixture_file = 'CMSSiteTreeFilterTest.yml';
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
class ContentControllerSearchExtensionTest extends SapphireTest {
|
class ContentControllerSearchExtensionTest extends SapphireTest {
|
||||||
|
|
||||||
public function testCustomSearchFormClassesToTest() {
|
public function testCustomSearchFormClassesToTest() {
|
||||||
@ -27,7 +30,7 @@ class ContentControllerSearchExtensionTest extends SapphireTest {
|
|||||||
public function tearDownOnce() {
|
public function tearDownOnce() {
|
||||||
parent::tearDownOnce();
|
parent::tearDownOnce();
|
||||||
|
|
||||||
Config::inst()->update('File', 'create_table_options', array('MySQLDatabase' => 'ENGINE=InnoDB'));
|
Config::inst()->update('File', 'create_table_options', array('SilverStripe\ORM\Connect\MySQLDatabase' => 'ENGINE=InnoDB'));
|
||||||
File::remove_extension('FulltextSearchable');
|
File::remove_extension('FulltextSearchable');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
class ErrorPageFileExtensionTest extends SapphireTest {
|
class ErrorPageFileExtensionTest extends SapphireTest {
|
||||||
|
|
||||||
protected static $fixture_file = 'ErrorPageTest.yml';
|
protected static $fixture_file = 'ErrorPageTest.yml';
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests link tracking to files and images.
|
* Tests link tracking to files and images.
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Possible actions:
|
* Possible actions:
|
||||||
* - action_save
|
* - action_save
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
||||||
*/
|
*/
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
* Tests {@see SiteTreeLinkTracking} broken links feature: LinkTracking
|
||||||
*
|
*
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\ValidationException;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,6 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use SilverStripe\Model\FieldType\DBVarchar;
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\ValidationException;
|
||||||
|
use SilverStripe\ORM\FieldType\DBVarchar;
|
||||||
|
use SilverStripe\ORM\DataExtension;
|
||||||
|
|
||||||
|
|
||||||
class VirtualPageTest extends FunctionalTest {
|
class VirtualPageTest extends FunctionalTest {
|
||||||
protected static $fixture_file = 'VirtualPageTest.yml';
|
protected static $fixture_file = 'VirtualPageTest.yml';
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\FieldType\DBDatetime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CmsReportsTest extends SapphireTest {
|
class CmsReportsTest extends SapphireTest {
|
||||||
|
|
||||||
protected static $fixture_file = 'CmsReportsTest.yml';
|
protected static $fixture_file = 'CmsReportsTest.yml';
|
||||||
@ -48,7 +51,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function testRecentlyEdited() {
|
public function testRecentlyEdited() {
|
||||||
SS_Datetime::set_mock_now('31-06-2009 00:00:00');
|
DBDatetime::set_mock_now('31-06-2009 00:00:00');
|
||||||
|
|
||||||
$after = $this->objFromFixture('SiteTree', 'after');
|
$after = $this->objFromFixture('SiteTree', 'after');
|
||||||
$before = $this->objFromFixture('SiteTree', 'before');
|
$before = $this->objFromFixture('SiteTree', 'before');
|
||||||
@ -60,7 +63,7 @@ class CmsReportsTest extends SapphireTest {
|
|||||||
$this->assertContains($after->ID, $r->records(array())->column('ID'));
|
$this->assertContains($after->ID, $r->records(array())->column('ID'));
|
||||||
$this->assertNotContains($before->ID, $r->records(array())->column('ID'));
|
$this->assertNotContains($before->ID, $r->records(array())->column('ID'));
|
||||||
|
|
||||||
SS_DateTime::clear_mock_now();
|
DBDatetime::clear_mock_now();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DB;
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage testing
|
* @subpackage testing
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\DataObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @package cms
|
* @package cms
|
||||||
* @subpackage tests
|
* @subpackage tests
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use SilverStripe\ORM\Versioning\Versioned;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>Fixture tree</h2>
|
* <h2>Fixture tree</h2>
|
||||||
* <code>
|
* <code>
|
||||||
|
Loading…
Reference in New Issue
Block a user