API Implement namespaces and update core API use - CLDR date formats in progress

This commit is contained in:
Robbie Averill 2017-09-06 15:49:23 +12:00
parent 0f61b1286d
commit 42fb360fb2
24 changed files with 625 additions and 336 deletions

18
.upgrade.yml Normal file
View File

@ -0,0 +1,18 @@
mappings:
ContentReviewCompatability: SilverStripe\ContentReview\Compatibility\ContentReviewCompatability
ContentReviewCMSExtension: SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension
ContentReviewDefaultSettings: SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings
ContentReviewOwner: SilverStripe\ContentReview\Extensions\ContentReviewOwner
SiteTreeContentReview: SilverStripe\ContentReview\Extensions\SiteTreeContentReview
ContentReviewNotificationJob: SilverStripe\ContentReview\Jobs\ContentReviewNotificationJob
ContentReviewLog: SilverStripe\ContentReview\Models\ContentReviewLog
PagesDueForReviewReport: SilverStripe\ContentReview\Reports\PagesDueForReviewReport
PagesWithoutReviewScheduleReport: SilverStripe\ContentReview\Reports\PagesWithoutReviewScheduleReport
ContentReviewEmails: SilverStripe\ContentReview\Tasks\ContentReviewEmails
ContentReviewOwnerMigrationTask: SilverStripe\ContentReview\Tasks\ContentReviewOwnerMigrationTask
ContentReviewBaseTest: SilverStripe\ContentReview\Tests\ContentReviewBaseTest
ContentReviewCMSPageEditControllerTest: SilverStripe\ContentReview\Tests\ContentReviewCMSPageEditControllerTest
ContentReviewNotificationTest: SilverStripe\ContentReview\Tests\ContentReviewNotificationTest
ContentReviewReportTest: SilverStripe\ContentReview\Tests\ContentReviewReportTest
ContentReviewSettingsTest: SilverStripe\ContentReview\Tests\ContentReviewSettingsTest
SiteTreeContentReviewTest: SilverStripe\ContentReview\Tests\SiteTreeContentReviewTest

View File

@ -1,18 +1,21 @@
SiteTree:
---
Name: contentreviewextensions
---
SilverStripe\CMS\Model\SiteTree:
extensions:
- SiteTreeContentReview
Group:
- SilverStripe\ContentReview\Extensions\SiteTreeContentReview
SilverStripe\Security\Group:
extensions:
- ContentReviewOwner
Member:
- SilverStripe\ContentReview\Extensions\ContentReviewOwner
SilverStripe\Security\Member:
extensions:
- ContentReviewOwner
CMSPageEditController:
- SilverStripe\ContentReview\Extensions\ContentReviewOwner
SilverStripe\CMS\Controllers\CMSPageEditController:
extensions:
- ContentReviewCMSExtension
CMSPageSettingsController:
- SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension
SilverStripe\CMS\Controllers\CMSPageSettingsController:
extensions:
- ContentReviewCMSExtension
SiteConfig:
- SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension
SilverStripe\SiteConfig\SiteConfig:
extensions:
- ContentReviewDefaultSettings
- SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings

View File

@ -22,7 +22,8 @@
"require": {
"silverstripe/framework": "^4@dev",
"silverstripe/cms": "^4@dev",
"silverstripe/reports": "^4@dev"
"silverstripe/reports": "^4@dev",
"silverstripe/siteconfig": "^4@dev"
},
"require-dev": {
"phpunit/phpunit": "^5.7",

View File

@ -1,5 +1,12 @@
<?php
namespace SilverStripe\ContentReview\Compatibility;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Subsites\Model\Subsite;
// @todo add translatable namespace
use Translatable;
/**
* This is a helper class which lets us do things with content review data without subsites
* and translatable messing our SQL queries up.
@ -25,12 +32,12 @@ class ContentReviewCompatability
self::TRANSLATABLE => null,
);
if (ClassInfo::exists("Subsite")) {
if (ClassInfo::exists(Subsite::class)) {
$compatibility[self::SUBSITES] = Subsite::$disable_subsite_filter;
Subsite::disable_subsite_filter(true);
}
if (ClassInfo::exists("Translatable")) {
if (ClassInfo::exists(Translatable::class)) {
$compatibility[self::TRANSLATABLE] = Translatable::locale_filter_enabled();
Translatable::disable_locale_filter();
}
@ -43,11 +50,11 @@ class ContentReviewCompatability
*/
public static function done(array $compatibility)
{
if (class_exists("Subsite")) {
if (class_exists(Subsite::class)) {
Subsite::$disable_subsite_filter = $compatibility[self::SUBSITES];
}
if (class_exists("Translatable")) {
if (class_exists(Translatable::class)) {
Translatable::enable_locale_filter($compatibility[self::TRANSLATABLE]);
}
}

View File

@ -1,5 +1,14 @@
<?php
namespace SilverStripe\ContentReview\Extensions;
use SilverStripe\Admin\LeftAndMainExtension;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Forms\Form;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
/**
* CMSPageEditController extension to receive the additional action button from
* SiteTreeContentReview::updateCMSActions()
@ -21,7 +30,7 @@ class ContentReviewCMSExtension extends LeftAndMainExtension
*
* @return string
*
* @throws SS_HTTPResponse_Exception
* @throws HTTPResponse_Exception
*/
public function savereview($data, Form $form)
{
@ -30,14 +39,17 @@ class ContentReviewCMSExtension extends LeftAndMainExtension
return Security::permissionFailure($this->owner);
}
$notes = (!empty($data["ReviewNotes"]) ? $data["ReviewNotes"] : _t("ContentReview.NOCOMMENTS", "(no comments)"));
$notes = (!empty($data["ReviewNotes"])
? $data["ReviewNotes"]
: _t("ContentReview.NOCOMMENTS", "(no comments)"));
$page->addReviewNote(Member::currentUser(), $notes);
$page->advanceReviewDate();
$this->owner->getResponse()->addHeader("X-Status", _t("ContentReview.REVIEWSUCCESSFUL", "Content reviewed successfully"));
$this->owner->getResponse()
->addHeader("X-Status", _t("ContentReview.REVIEWSUCCESSFUL", "Content reviewed successfully"));
return $this->owner->redirectBack();
}
/**
* Find the page this form is updating
*
@ -48,7 +60,7 @@ class ContentReviewCMSExtension extends LeftAndMainExtension
protected function findRecord($data)
{
if (empty($data["ID"])) {
throw new SS_HTTPResponse_Exception("No record ID", 404);
throw new HTTPResponse_Exception("No record ID", 404);
}
$page = null;
@ -58,7 +70,7 @@ class ContentReviewCMSExtension extends LeftAndMainExtension
}
if (!$page || !$page->ID) {
throw new SS_HTTPResponse_Exception("Bad record ID #{$id}", 404);
throw new HTTPResponse_Exception("Bad record ID #{$id}", 404);
}
return $page;

View File

@ -1,5 +1,20 @@
<?php
namespace SilverStripe\ContentReview\Extensions;
use SilverStripe\Core\Config\Config;
use SilverStripe\Control\Email\Email;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\TextareaField;
use SilverStripe\Forms\TextField;
use SilverStripe\ORM\DataExtension;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
/**
* This extensions add a default schema for new pages and pages without a content
* review setting.
@ -36,8 +51,8 @@ class ContentReviewDefaultSettings extends DataExtension
* @var array
*/
private static $many_many = array(
'ContentReviewGroups' => 'Group',
'ContentReviewUsers' => 'Member',
'ContentReviewGroups' => Group::class,
'ContentReviewUsers' => Member::class,
);
/**
@ -49,7 +64,7 @@ class ContentReviewDefaultSettings extends DataExtension
*
* @var string
*/
private static $content_review_template = 'ContentReviewEmail';
private static $content_review_template = 'SilverStripe\\ContentReview\\ContentReviewEmail';
/**
* @return string
@ -121,7 +136,6 @@ class ContentReviewDefaultSettings extends DataExtension
asort($usersMap);
$userField = ListboxField::create('OwnerUsers', _t('ContentReview.PAGEOWNERUSERS', 'Users'), $usersMap)
->setMultiple(true)
->setAttribute('data-placeholder', _t('ContentReview.ADDUSERS', 'Add users'))
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
@ -137,7 +151,6 @@ class ContentReviewDefaultSettings extends DataExtension
asort($groupsMap);
$groupField = ListboxField::create('OwnerGroups', _t('ContentReview.PAGEOWNERGROUPS', 'Groups'), $groupsMap)
->setMultiple(true)
->setAttribute('data-placeholder', _t('ContentReview.ADDGROUP', 'Add groups'))
->setDescription(_t('ContentReview.OWNERGROUPSDESCRIPTION', 'Page owners that are responsible for reviews'));
@ -151,7 +164,10 @@ class ContentReviewDefaultSettings extends DataExtension
->setRightTitle(_t('Review.EMAILFROM_RIGHTTITLE', 'e.g: do-not-reply@site.com')),
TextField::create('ReviewSubject', _t('ContentReview.EMAILSUBJECT', 'Subject line')),
TextAreaField::create('ReviewBody', _t('ContentReview.EMAILTEMPLATE', 'Email template')),
LiteralField::create('TemplateHelp', $this->owner->renderWith('ContentReviewAdminHelp')),
LiteralField::create(
'TemplateHelp',
$this->owner->renderWith('SilverStripe\\ContentReview\\ContentReviewAdminHelp')
),
)
);
}
@ -200,7 +216,7 @@ class ContentReviewDefaultSettings extends DataExtension
}
// Fall back to admin email
return Config::inst()->get('Email', 'admin_email');
return Config::inst()->get(Email::class, 'admin_email');
}
/**
@ -217,7 +233,7 @@ class ContentReviewDefaultSettings extends DataExtension
return $value;
}
// fallback to default value
$defaults = $this->owner->config()->defaults;
$defaults = $this->owner->config()->get('defaults');
if (isset($defaults[$field])) {
return $defaults[$field];
}

View File

@ -1,5 +1,10 @@
<?php
namespace SilverStripe\ContentReview\Extensions;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataExtension;
/**
* Description of GroupContentReview.
*/
@ -9,6 +14,6 @@ class ContentReviewOwner extends DataExtension
* @var array
*/
private static $many_many = array(
"SiteTreeContentReview" => "SiteTree",
"SiteTreeContentReview" => SiteTree::class,
);
}

View File

@ -1,5 +1,45 @@
<?php
namespace SilverStripe\ContentReview\Extensions;
use Exception;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ContentReview\Jobs\ContentReviewNotificationJob;
use SilverStripe\ContentReview\Models\ContentReviewLog;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\LiteralField;
use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\CompositeField;
use SilverStripe\Forms\Tab;
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\DropdownField;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;
use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\Forms\GridField\GridFieldSortableHeader;
use SilverStripe\Forms\ListboxField;
use SilverStripe\Forms\OptionsetField;
use SilverStripe\Forms\ReadonlyField;
use SilverStripe\Forms\HeaderField;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBDate;
use SilverStripe\ORM\SS_List;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\Security\Permission;
use SilverStripe\Security\PermissionProvider;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\View\Requirements;
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
/**
* Set dates at which content needs to be reviewed and provide a report and emails to alert
* to content needing review.
@ -38,15 +78,15 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
* @var array
*/
private static $has_many = array(
"ReviewLogs" => "ContentReviewLog",
"ReviewLogs" => ContentReviewLog::class,
);
/**
* @var array
*/
private static $belongs_many_many = array(
"ContentReviewGroups" => "Group",
"ContentReviewUsers" => "Member",
"ContentReviewGroups" => Group::class,
"ContentReviewUsers" => Member::class,
);
/**
@ -70,7 +110,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/
public static function get_schedule()
{
return self::$schedule;
return Config::inst()->get(static::class, 'schedule');
}
/**
@ -99,9 +139,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
array_unique($groupIDs);
if (count($groupIDs)) {
$groupMembers = DataObject::get("Member")->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
$groupMembers = DataObject::get(Member::class)->where("\"Group\".\"ID\" IN (" . implode(",", $groupIDs) . ")")
->leftJoin("Group_Members", "\"Member\".\"ID\" = \"Group_Members\".\"MemberID\"")
->leftJoin("Group", "\"Group_Members\".\"GroupID\" = \"Group\".\"ID\"");
/** @skipUpgrade */
->leftJoin('Group', "\"Group_Members\".\"GroupID\" = \"Group\".\"ID\"");
$contentReviewOwners->merge($groupMembers);
}
@ -118,8 +159,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/
public function updateCMSActions(FieldList $actions)
{
if ($this->canBeReviewedBy(Member::currentUser())) {
Requirements::css("contentreview/css/contentreview.css");
if ($this->canBeReviewedBy(Security::getCurrentUser())) {
Requirements::css("silverstripe/contentreview:css/contentreview.css");
$reviewTitle = LiteralField::create(
"ReviewContentNotesLabel",
@ -155,8 +196,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$page = $this->owner;
}
if ($page->obj("NextReviewDate")->exists()) {
return $page->obj("NextReviewDate");
if ($page->obj('NextReviewDate')->exists()) {
return $page->obj('NextReviewDate');
}
$options = $this->owner->getOptions();
@ -170,9 +211,9 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
}
// Failover to check on ReviewPeriodDays + LastEdited
$nextReviewUnixSec = strtotime(" + " . $options->ReviewPeriodDays . " days", SS_Datetime::now()->format("U"));
$date = Date::create("NextReviewDate");
$date->setValue(date("Y-m-d H:i:s", $nextReviewUnixSec));
$nextReviewUnixSec = strtotime('now + ' . $options->ReviewPeriodDays . ' days');
$date = DBDate::create('NextReviewDate');
$date->setValue($nextReviewUnixSec);
return $date;
}
@ -205,7 +246,6 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
// $page is inheriting it's settings from it's parent, find
// the first valid parent with a valid setting
while ($parent = $page->Parent()) {
// Root page, use site config
if (!$parent->exists()) {
return SiteConfig::current_site_config();
@ -254,7 +294,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/
public function getEditorName()
{
$member = Member::currentUser();
$member = Security::getCurrentUser();
if ($member) {
return $member->getTitle();
@ -298,7 +338,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/
public function updateSettingsFields(FieldList $fields)
{
Requirements::javascript("contentreview/javascript/contentreview.js");
Requirements::javascript("silverstripe/contentreview:javascript/contentreview.js");
// Display read-only version only
if (!Permission::check("EDIT_CONTENT_REVIEW_FIELDS")) {
@ -313,8 +353,8 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
}
$logConfig = GridFieldConfig::create()
->addComponent(new GridFieldSortableHeader())
->addComponent($logColumns = new GridFieldDataColumns());
->addComponent(Injector::inst()->create(GridFieldSortableHeader::class))
->addComponent($logColumns = Injector::inst()->create(GridFieldDataColumns::class));
// Cast the value to the users preferred date format
$logColumns->setFieldCasting(array(
@ -351,7 +391,6 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
asort($usersMap);
$userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap)
->setMultiple(true)
->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users"))
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
@ -364,15 +403,11 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
asort($groupsMap);
$groupField = ListboxField::create("OwnerGroups", _t("ContentReview.PAGEOWNERGROUPS", "Groups"), $groupsMap)
->setMultiple(true)
->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups"))
->setDescription(_t("ContentReview.OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews"));
$reviewDate = DateField::create("NextReviewDate", _t("ContentReview.NEXTREVIEWDATE", "Next review date"))
->setConfig("showcalendar", true)
->setConfig("dateformat", "yyyy-MM-dd")
->setConfig("datavalueformat", "yyyy-MM-dd")
->setDescription(_t("ContentReview.NEXTREVIEWDATADESCRIPTION", "Leave blank for no review"));
$reviewFrequency = DropdownField::create(
@ -386,7 +421,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
$fields->addFieldsToTab("Root.ContentReview", array(
new HeaderField(_t("ContentReview.REVIEWHEADER", "Content review"), 2),
HeaderField::create('ContentReviewHeader', _t("ContentReview.REVIEWHEADER", "Content review"), 2),
$viewersOptionsField,
CompositeField::create(
$userField,
@ -426,9 +461,9 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$options = $this->getOptions();
if ($options && $options->ReviewPeriodDays) {
$nextDate = date('Y-m-d', strtotime('+ ' . $options->ReviewPeriodDays . ' days', SS_Datetime::now()->format('U')));
$nextDateTimestamp = strtotime('now + ' . $options->ReviewPeriodDays . ' days');
$this->owner->NextReviewDate = $nextDate;
$this->owner->NextReviewDate = DBDate::create()->setValue($nextDateTimestamp)->Format('y-MM-dd');
$this->owner->write();
}
@ -453,12 +488,12 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
}
$options = $this->getOptions();
if (!$options) {
return false;
}
if (!$options || !$options->hasExtension($this->class)) {
if (!$options || !$options->hasExtension(__CLASS__)) {
return false;
}
@ -488,7 +523,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
{
// Only update if DB fields have been changed
$changedFields = $this->owner->getChangedFields(true, 2);
if($changedFields) {
if ($changedFields) {
$this->owner->LastEditedByName = $this->owner->getEditorName();
$this->owner->OwnerNames = $this->owner->getOwnerNames();
}
@ -518,9 +553,9 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
// parent page change its review period
// && !$this->owner->isChanged('ContentReviewType', 2)
if ($this->owner->isChanged("ReviewPeriodDays", 2)) {
$nextReviewUnixSec = strtotime(" + " . $this->owner->ReviewPeriodDays . " days", SS_Datetime::now()->format("U"));
$this->owner->NextReviewDate = date("Y-m-d", $nextReviewUnixSec);
if ($this->owner->isChanged('ReviewPeriodDays', 2)) {
$nextReviewUnixSec = strtotime('now + ' . $this->owner->ReviewPeriodDays . ' days');
$this->owner->NextReviewDate = DBDate::create()->setValue($nextReviewUnixSec)->Format('y-MM-dd');
}
}
@ -591,14 +626,14 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
*/
public function requireDefaultRecords()
{
if (class_exists("ContentReviewNotificationJob")) {
if (class_exists(ContentReviewNotificationJob::class)) {
// Ensure there is not already a job queued
if (QueuedJobDescriptor::get()->filter("Implementation", "ContentReviewNotificationJob")->first()) {
if (QueuedJobDescriptor::get()->filter("Implementation", ContentReviewNotificationJob::class)->first()) {
return;
}
$nextRun = new ContentReviewNotificationJob();
$runHour = Config::inst()->get("ContentReviewNotificationJob", "first_run_hour");
$nextRun = Injector::inst()->create(ContentReviewNotificationJob::class);
$runHour = Config::inst()->get(ContentReviewNotificationJob::class, "first_run_hour");
$firstRunTime = date("Y-m-d H:i:s", mktime($runHour, 0, 0, date("m"), date("d") + 1, date("y")));
singleton("QueuedJobService")->queueJob(

View File

@ -1,6 +1,14 @@
<?php
if (!class_exists("AbstractQueuedJob")) {
namespace SilverStripe\ContentReview\Jobs;
use SilverStripe\ContentReview\Tasks\ContentReviewEmails;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Core\Config\Config;
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
use Symbiote\QueuedJobs\Services\QueuedJob;
if (!class_exists(AbstractQueuedJob::class)) {
return;
}
@ -76,7 +84,7 @@ class ContentReviewNotificationJob extends AbstractQueuedJob implements QueuedJo
$this->queueNextRun();
$task = new ContentReviewEmails();
$task->run(new SS_HTTPRequest("GET", "/dev/tasks/ContentReviewEmails"));
$task->run(new HTTPRequest("GET", "/dev/tasks/ContentReviewEmails"));
$this->currentStep = 1;
$this->isComplete = true;

View File

@ -1,5 +1,11 @@
<?php
namespace SilverStripe\ContentReview\Models;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataObject;
use SilverStripe\Security\Security;
class ContentReviewLog extends DataObject
{
/**
@ -13,8 +19,8 @@ class ContentReviewLog extends DataObject
* @var array
*/
private static $has_one = array(
"Reviewer" => "Member",
"SiteTree" => "SiteTree",
"Reviewer" => Member::class,
"SiteTree" => SiteTree::class,
);
/**
@ -31,6 +37,8 @@ class ContentReviewLog extends DataObject
*/
private static $default_sort = "Created DESC";
private static $table_name = 'ContentReviewLog';
/**
* @param mixed $member
*
@ -38,6 +46,6 @@ class ContentReviewLog extends DataObject
*/
public function canView($member = null)
{
return (bool) Member::currentUser();
return (bool) Security::getCurrentUser();
}
}

View File

@ -1,11 +1,29 @@
<?php
require_once "Zend/Date.php";
namespace SilverStripe\ContentReview\Reports;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
use SilverStripe\Core\ClassInfo;
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Convert;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\DateField;
use SilverStripe\Forms\FieldList;
use SilverStripe\i18n\i18n;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Reports\Report;
use SilverStripe\Security\Security;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned;
/**
* Show all pages that need to be reviewed.
*/
class PagesDueForReviewReport extends SS_Report
class PagesDueForReviewReport extends Report
{
/**
* @return string
@ -20,21 +38,36 @@ class PagesDueForReviewReport extends SS_Report
*/
public function parameterFields()
{
$filtersList = new FieldList();
$filtersList = FieldList::create();
$filtersList->push(
DateField::create("ReviewDateAfter", _t("PagesDueForReviewReport.REVIEWDATEAFTER", "Review date after or on"))
->setConfig("showcalendar", true)
DateField::create(
"ReviewDateAfter",
_t("PagesDueForReviewReport.REVIEWDATEAFTER", "Review date after or on")
)
);
$filtersList->push(
DateField::create("ReviewDateBefore", _t("PagesDueForReviewReport.REVIEWDATEBEFORE", "Review date before or on"), date("d/m/Y", strtotime("midnight")))
->setConfig("showcalendar", true)
DateField::create(
"ReviewDateBefore",
_t("PagesDueForReviewReport.REVIEWDATEBEFORE", "Review date before or on"),
date("d/m/Y", strtotime("midnight"))
)
);
$filtersList->push(new CheckboxField("ShowVirtualPages", _t("PagesDueForReviewReport.SHOWVIRTUALPAGES", "Show Virtual Pages")));
$filtersList->push(
CheckboxField::create(
"ShowVirtualPages",
_t("PagesDueForReviewReport.SHOWVIRTUALPAGES", "Show Virtual Pages")
)
);
$filtersList->push(new CheckboxField("OnlyMyPages", _t("PagesDueForReviewReport.ONLYMYPAGES", "Only Show pages assigned to me")));
$filtersList->push(
CheckboxField::create(
"OnlyMyPages",
_t("PagesDueForReviewReport.ONLYMYPAGES", "Only Show pages assigned to me")
)
);
return $filtersList;
}
@ -44,7 +77,7 @@ class PagesDueForReviewReport extends SS_Report
*/
public function columns()
{
$linkBase = singleton("CMSPageEditController")->Link("show");
$linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
@ -80,7 +113,8 @@ class PagesDueForReviewReport extends SS_Report
$liveLink = $item->AbsoluteLiveLink;
$stageLink = $item->AbsoluteLink();
return sprintf("%s <a href='%s'>%s</a>",
return sprintf(
"%s <a href='%s'>%s</a>",
$stageLink,
$liveLink ? $liveLink : $stageLink . "?stage=Stage",
$liveLink ? "(live)" : "(draft)"
@ -120,36 +154,35 @@ class PagesDueForReviewReport extends SS_Report
*/
public function sourceRecords($params = array())
{
Versioned::reading_stage("Stage");
Versioned::set_stage(Versioned::DRAFT);
$records = SiteTree::get();
$compatibility = ContentReviewCompatability::start();
if (empty($params["ReviewDateBefore"]) && empty($params["ReviewDateAfter"])) {
if (empty($params['ReviewDateBefore']) && empty($params['ReviewDateAfter'])) {
// If there's no review dates set, default to all pages due for review now
$reviewDate = new Zend_Date(SS_Datetime::now()->Format("U"));
$reviewDate->add(1, Zend_Date::DAY);
$records = $records->where(sprintf('"NextReviewDate" < \'%s\'', $reviewDate->toString("YYYY-MM-dd")));
$nextReviewUnixSec = strtotime(' + 1 day', DBDatetime::now()->format('U'));
$records = $records->where(sprintf('"NextReviewDate" < \'%s\'', date('Y-m-d', $nextReviewUnixSec)));
} else {
// Review date before
if (!empty($params['ReviewDateBefore'])) {
// TODO Get value from DateField->dataValue() once we have access to form elements here
$reviewDate = new Zend_Date($params["ReviewDateBefore"], Config::inst()->get("i18n", "date_format"));
$reviewDate->add(1, Zend_Date::DAY);
$records = $records->where(sprintf("\"NextReviewDate\" < '%s'", $reviewDate->toString("YYYY-MM-dd")));
$nextReviewUnixSec = strtotime(' + 1 day', strtotime($params['ReviewDateBefore']));
$records = $records->where(sprintf("\"NextReviewDate\" < '%s'", date('Y-m-d', $nextReviewUnixSec)));
}
// Review date after
if (!empty($params["ReviewDateAfter"])) {
if (!empty($params['ReviewDateAfter'])) {
// TODO Get value from DateField->dataValue() once we have access to form elements here
$reviewDate = new Zend_Date($params["ReviewDateAfter"], Config::inst()->get("i18n", "date_format"));
$records = $records->where(sprintf("\"NextReviewDate\" >= '%s'", $reviewDate->toString("YYYY-MM-dd")));
$records = $records->where(
sprintf("\"NextReviewDate\" >= '%s'", date('Y-m-d', strtotime($params['ReviewDateAfter'])))
);
}
}
// Show virtual pages?
if (empty($params["ShowVirtualPages"])) {
$virtualPageClasses = ClassInfo::subclassesFor("VirtualPage");
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses))
@ -157,15 +190,15 @@ class PagesDueForReviewReport extends SS_Report
}
// Owner dropdown
if (!empty($params["ContentReviewOwner"])) {
$ownerNames = Convert::raw2sql($params["ContentReviewOwner"]);
if (!empty($params[ContentReviewOwner::class])) {
$ownerNames = Convert::raw2sql($params[ContentReviewOwner::class]);
$records = $records->filter("OwnerNames:PartialMatch", $ownerNames);
}
// Only show pages assigned to the current user?
// This come last because it transforms $records to an ArrayList.
if (!empty($params["OnlyMyPages"])) {
$currentUser = Member::currentUser();
$currentUser = Security::getCurrentUser();
$records = $records->filterByCallback(function ($page) use ($currentUser) {
$options = $page->getOptions();

View File

@ -1,11 +1,24 @@
<?php
require_once "Zend/Date.php";
namespace SilverStripe\ContentReview\Reports;
use SilverStripe\Forms\CheckboxField;
use SilverStripe\Forms\FieldList;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Model\VirtualPage;
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
use SilverStripe\Core\ClassInfo;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\DataObject;
use SilverStripe\Reports\Report;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\Versioned\Versioned;
/**
* Show all pages that need to be reviewed.
*/
class PagesWithoutReviewScheduleReport extends SS_Report
class PagesWithoutReviewScheduleReport extends Report
{
/**
* @return string
@ -20,8 +33,8 @@ class PagesWithoutReviewScheduleReport extends SS_Report
*/
public function parameterFields()
{
$params = new FieldList();
$params->push(new CheckboxField("ShowVirtualPages", "Show Virtual Pages"));
$params = FieldList::create();
$params->push(CheckboxField::create("ShowVirtualPages", "Show Virtual Pages"));
return $params;
}
@ -31,7 +44,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report
*/
public function columns()
{
$linkBase = singleton("CMSPageEditController")->Link("show");
$linkBase = singleton(CMSPageEditController::class)->Link("show");
$linkPath = parse_url($linkBase, PHP_URL_PATH);
$linkQuery = parse_url($linkBase, PHP_URL_QUERY);
@ -54,7 +67,8 @@ class PagesWithoutReviewScheduleReport extends SS_Report
$liveLink = $item->AbsoluteLiveLink;
$stageLink = $item->AbsoluteLink();
return sprintf("%s <a href='%s'>%s</a>",
return sprintf(
"%s <a href='%s'>%s</a>",
$stageLink,
$liveLink ? $liveLink : $stageLink . "?stage=Stage",
$liveLink ? "(live)" : "(draft)"
@ -94,7 +108,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report
*/
public function sourceRecords($params = array())
{
Versioned::reading_stage("Stage");
Versioned::set_stage(Versioned::DRAFT);
$records = SiteTree::get();
$compatibility = ContentReviewCompatability::start();
@ -103,7 +117,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report
// Show virtual pages?
if (empty($params["ShowVirtualPages"])) {
$virtualPageClasses = ClassInfo::subclassesFor("VirtualPage");
$virtualPageClasses = ClassInfo::subclassesFor(VirtualPage::class);
$records = $records->where(sprintf(
"\"SiteTree\".\"ClassName\" NOT IN ('%s')",
implode("','", array_values($virtualPageClasses))
@ -114,7 +128,7 @@ class PagesWithoutReviewScheduleReport extends SS_Report
$records = $records->toArray();
// Trim out calculated values
$list = new ArrayList();
$list = ArrayList::create();
foreach ($records as $record) {
if (!$this->hasReviewSchedule($record)) {
$list->push($record);

View File

@ -1,12 +1,28 @@
<?php
namespace SilverStripe\ContentReview\Tasks;
use Page;
use SilverStripe\ContentReview\Compatibility\ContentReviewCompatability;
use SilverStripe\Control\Email\Email;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\BuildTask;
use SilverStripe\ORM\ArrayList;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\FieldType\DBField;
use SilverStripe\ORM\SS_List;
use SilverStripe\Security\Member;
use SilverStripe\SiteConfig\SiteConfig;
use SilverStripe\View\ArrayData;
use SilverStripe\View\SSViewer;
/**
* Daily task to send emails to the owners of content items when the review date rolls around.
*/
class ContentReviewEmails extends BuildTask
{
/**
* @param SS_HTTPRequest $request
* @param HTTPRequest $request
*/
public function run($request)
{
@ -14,7 +30,7 @@ class ContentReviewEmails extends BuildTask
// First grab all the pages with a custom setting
$pages = Page::get()
->filter('NextReviewDate:LessThanOrEqual', SS_Datetime::now()->URLDate());
->filter('NextReviewDate:LessThanOrEqual', DBDatetime::now()->URLDate());
$overduePages = $this->getOverduePagesForOwners($pages);
@ -28,11 +44,11 @@ class ContentReviewEmails extends BuildTask
}
/**
* @param SS_list $pages
* @param SS_List $pages
*
* @return array
*/
protected function getOverduePagesForOwners(SS_list $pages)
protected function getOverduePagesForOwners(SS_List $pages)
{
$overduePages = array();
@ -45,7 +61,7 @@ class ContentReviewEmails extends BuildTask
foreach ($option->ContentReviewOwners() as $owner) {
if (!isset($overduePages[$owner->ID])) {
$overduePages[$owner->ID] = new ArrayList();
$overduePages[$owner->ID] = ArrayList::create();
}
$overduePages[$owner->ID]->push($page);
@ -67,7 +83,7 @@ class ContentReviewEmails extends BuildTask
$templateVariables = $this->getTemplateVariables($owner, $siteConfig, $pages);
// Build email
$email = new Email();
$email = Email::create();
$email->setTo($owner->Email);
$email->setFrom($siteConfig->ReviewFrom);
$email->setSubject($siteConfig->ReviewSubject);
@ -76,13 +92,17 @@ class ContentReviewEmails extends BuildTask
$body = $this->getEmailBody($siteConfig, $templateVariables);
// Populate mail body with fixed template
$email->setTemplate($siteConfig->config()->content_review_template);
$email->populateTemplate($templateVariables);
$email->populateTemplate(array(
'EmailBody' => $body,
'Recipient' => $owner,
'Pages' => $pages,
));
$email->setHTMLTemplate($siteConfig->config()->get('content_review_template'));
$email->setData(
array_merge(
$templateVariables,
[
'EmailBody' => $body,
'Recipient' => $owner,
'Pages' => $pages,
]
)
);
$email->send();
}
@ -97,7 +117,7 @@ class ContentReviewEmails extends BuildTask
protected function getEmailBody($config, $variables)
{
$template = SSViewer::fromString($config->ReviewBody);
$value = $template->process(new ArrayData($variables));
$value = $template->process(ArrayData::create($variables));
// Cast to HTML
return DBField::create_field('HTMLText', (string) $value);
@ -117,13 +137,13 @@ class ContentReviewEmails extends BuildTask
*/
protected function getTemplateVariables($recipient, $config, $pages)
{
return array(
return [
'Subject' => $config->ReviewSubject,
'PagesCount' => $pages->count(),
'FromEmail' => $config->ReviewFrom,
'ToFirstName' => $recipient->FirstName,
'ToSurname' => $recipient->Surname,
'ToEmail' => $recipient->Email,
);
];
}
}

View File

@ -1,12 +1,18 @@
<?php
namespace SilverStripe\ContentReview\Tasks;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\BuildTask;
use SilverStripe\ORM\DB;
/**
* Task which migrates the ContentReview Module's SiteTree->OwnerID column to a new column name.
*/
class ContentReviewOwnerMigrationTask extends BuildTask
{
/**
* @param SS_HTTPRequest $request
* @param HTTPRequest $request
*/
public function run($request)
{
@ -20,7 +26,7 @@ class ContentReviewOwnerMigrationTask extends BuildTask
DB::query("UPDATE \"SiteTree_versions\" SET \"ContentReviewOwnerID\" = \"OwnerID\"");
DB::query("ALTER TABLE \"SiteTree\" DROP COLUMN \"OwnerID\"");
DB::query("ALTER TABLE \"SiteTree_Live\" DROP COLUMN \"OwnerID\"");
DB::query("ALTER TABLE \"SiteTree_versions\" DROP COLUMN \"OwnerID\"");
DB::query("ALTER TABLE \"SiteTree_Versions\" DROP COLUMN \"OwnerID\"");
echo "<h1>Migrated 3 tables. Dropped obsolete OwnerID column</h1>";
}
}

View File

@ -12,12 +12,12 @@
<% loop Pages %>
<tr>
<td valign="top">$Title</td>
<td><a href="{$BaseURL}admin/pages/edit/show/$ID"><% _t('ContentReviewEmails.REVIEWPAGELINK','Review the page in the CMS') %></a><br />
<a href="$AbsoluteLink"><% _t('ContentReviewEmails.VIEWPUBLISHEDLINK','View this page on the website') %></a>
<td><a href="{$BaseURL}admin/pages/edit/show/$ID"><%t ContentReviewEmails.REVIEWPAGELINK 'Review the page in the CMS' %></a><br />
<a href="$AbsoluteLink"><%t ContentReviewEmails.VIEWPUBLISHEDLINK View this page on the website' %></a>
</td>
</tr>
<% end_loop %>
</tbody>
</table>
</body>
</html>
</html>

View File

@ -1,5 +1,12 @@
<?php
namespace SilverStripe\ContentReview\Tests;
use SilverStripe\Dev\FunctionalTest;
use SilverStripe\CMS\Model\SiteTree;
// @todo add translatable namespace
use Translatable;
/**
* Extend this class when writing unit tests which are compatible with other modules.
* All compatibility code goes here.
@ -11,7 +18,7 @@ abstract class ContentReviewBaseTest extends FunctionalTest
*/
protected $translatableEnabledBefore;
public function setUp()
protected function setUp()
{
parent::setUp();
@ -21,21 +28,21 @@ abstract class ContentReviewBaseTest extends FunctionalTest
* (e.g. $this->post()) do not seem to get passed the tester's locale, but instead fallback to the default locale.
*
* So we set the pages locale to be the default locale, which will then match any subsequent requests.
*
*
* If creating pages in your unit tests (rather than reading from the fixtures file), you must explicitly call
* self::compat() on the page, for the same reasons as above.
*/
if (class_exists("Translatable")) {
$this->translatableEnabledBefore = SiteTree::has_extension("Translatable");
SiteTree::remove_extension("Translatable");
if (class_exists(Translatable::class)) {
$this->translatableEnabledBefore = SiteTree::has_extension(Translatable::class);
SiteTree::remove_extension(Translatable::class);
}
}
public function tearDown()
protected function tearDown()
{
if (class_exists("Translatable")) {
if (class_exists(Translatable::class)) {
if ($this->translatableEnabledBefore) {
SiteTree::add_extension("Translatable");
SiteTree::add_extension(Translatable::class);
}
}

View File

@ -1,5 +1,21 @@
<?php
namespace SilverStripe\ContentReview\Tests;
use Page;
use SilverStripe\CMS\Controllers\CMSPageEditController;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
use SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings;
use SilverStripe\Control\HTTPResponse_Exception;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Security\Group;
use SilverStripe\Security\Member;
use SilverStripe\SiteConfig\SiteConfig;
/**
* @mixin PHPUnit_Framework_TestCase
*/
@ -8,27 +24,27 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
/**
* @var string
*/
public static $fixture_file = "contentreview/tests/ContentReviewTest.yml";
protected static $fixture_file = 'ContentReviewTest.yml';
/**
* @var array
*/
protected $requiredExtensions = array(
"SiteTree" => array("SiteTreeContentReview"),
"Group" => array("ContentReviewOwner"),
"Member" => array("ContentReviewOwner"),
"CMSPageEditController" => array("ContentReviewCMSExtension"),
"SiteConfig" => array("ContentReviewDefaultSettings"),
);
protected static $required_extensions = [
SiteTree::class => [SiteTreeContentReview::class],
Group::class => [ContentReviewOwner::class],
Member::class => [ContentReviewOwner::class],
CMSPageEditController::class => [ContentReviewCMSExtension::class],
SiteConfig::class => [ContentReviewDefaultSettings::class],
];
public function testReviewedThrowsExceptionWithNoRecordID()
{
$this->setExpectedException("SS_HTTPResponse_Exception");
$this->setExpectedException(HTTPResponse_Exception::class);
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
$controller = new CMSPageEditController();
$dummyForm = new CMSForm($controller, "EditForm", new FieldList(), new FieldList());
$dummyForm = new Form($controller, "EditForm", new FieldList(), new FieldList());
$controller->savereview(array(
"ID" => null,
@ -38,12 +54,12 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
public function testReviewedThrowsExceptionWithWrongRecordID()
{
$this->setExpectedException("SS_HTTPResponse_Exception");
$this->setExpectedException(HTTPResponse_Exception::class);
/** @var CMSPageEditController|ContentReviewCMSExtension $controller */
$controller = new CMSPageEditController();
$dummyForm = new CMSForm($controller, "EditForm", new FieldList(), new FieldList());
$dummyForm = new Form($controller, "EditForm", new FieldList(), new FieldList());
$controller->savereview(array(
"ID" => "FAIL",
@ -54,20 +70,20 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
public function testReviewedWithAuthor()
{
/** @var Member $author */
$author = $this->objFromFixture("Member", "author");
$author = $this->objFromFixture(Member::class, "author");
$this->loginAs($author);
/** @var Page|SiteTreeContentReview $page */
$page = $this->objFromFixture("Page", "home");
$page = $this->objFromFixture(Page::class, "home");
$data = array(
"action_savereview" => 1,
"ID" => $page->ID,
"ID" => $page->ID,
);
$this->get('admin/pages/edit/show/' . $page->ID);
$response = $this->post(singleton('CMSPageEditController')->getEditForm($page->ID)->FormAction(), $data);
$response = $this->post(singleton(CMSPageEditController::class)->getEditForm($page->ID)->FormAction(), $data);
$this->assertEquals("OK", $response->getStatusDescription());
$this->assertEquals(200, $response->getStatusCode());
@ -76,21 +92,21 @@ class ContentReviewCMSPageEditControllerTest extends ContentReviewBaseTest
public function testSaveReview()
{
/** @var Member $author */
$author = $this->objFromFixture("Member", "author");
$author = $this->objFromFixture(Member::class, "author");
$this->loginAs($author);
$this->logInAs($author);
/** @var Page|SiteTreeContentReview $page */
$page = $this->objFromFixture("Page", "home");
$page = $this->objFromFixture(Page::class, "home");
$data = array(
"action_savereview" => 1,
"ID" => $page->ID,
"ReviewNotes" => "This is the best page ever",
"ID" => $page->ID,
"ReviewNotes" => "This is the best page ever",
);
$this->get('admin/pages/edit/show/' . $page->ID);
$response = $this->post(singleton('CMSPageEditController')->getEditForm($page->ID)->FormAction(), $data);
$response = $this->post(singleton(CMSPageEditController::class)->getEditForm($page->ID)->FormAction(), $data);
$this->assertEquals("OK", $response->getStatusDescription());
$this->assertEquals(200, $response->getStatusCode());

View File

@ -1,5 +1,19 @@
<?php
namespace SilverStripe\ContentReview\Tests;
use Page;
use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ContentReview\Extensions\ContentReviewCMSExtension;
use SilverStripe\ContentReview\Extensions\ContentReviewDefaultSettings;
use SilverStripe\ContentReview\Extensions\ContentReviewOwner;
use SilverStripe\ContentReview\Extensions\SiteTreeContentReview;
use SilverStripe\ContentReview\Tasks\ContentReviewEmails;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\SiteConfig\SiteConfig;
/**
* @mixin PHPUnit_Framework_TestCase
*/
@ -8,14 +22,14 @@ class ContentReviewNotificationTest extends SapphireTest
/**
* @var string
*/
public static $fixture_file = 'contentreview/tests/ContentReviewTest.yml';
protected static $fixture_file = 'ContentReviewTest.yml';
public function setUp()
protected function setUp()
{
parent::setUp();
// Hack to ensure only desired siteconfig is scaffolded
$desiredID = $this->idFromFixture('SiteConfig', 'mysiteconfig');
$desiredID = $this->idFromFixture(SiteConfig::class, 'mysiteconfig');
foreach (SiteConfig::get()->exclude('ID', $desiredID) as $config) {
$config->delete();
}
@ -24,25 +38,25 @@ class ContentReviewNotificationTest extends SapphireTest
/**
* @var array
*/
protected $requiredExtensions = array(
'SiteTree' => array('SiteTreeContentReview'),
'Group' => array('ContentReviewOwner'),
'Member' => array('ContentReviewOwner'),
'CMSPageEditController' => array('ContentReviewCMSExtension'),
'SiteConfig' => array('ContentReviewDefaultSettings'),
);
protected static $required_extensions = [
SiteTree::class => [SiteTreeContentReview::class],
Group::class => [ContentReviewOwner::class],
Member::class => [ContentReviewOwner::class],
CMSPageEditController::class => [ContentReviewCMSExtension::class],
SiteConfig::class => [ContentReviewDefaultSettings::class],