FIX: PHP changes not automatically made by the upgrader.

This commit is contained in:
Sam Minnee 2016-09-10 15:30:32 +12:00
parent 377a8cdc7c
commit 44c0c8c25e
9 changed files with 25 additions and 23 deletions

View File

@ -19,7 +19,7 @@ class BlogEntry extends BlogPost implements MigratableObject
* @var array
*/
private static $db = array(
'Date' => 'SS_Datetime',
'Date' => 'Datetime',
'Author' => 'Text',
'Tags' => 'Text',
);
@ -27,7 +27,7 @@ class BlogEntry extends BlogPost implements MigratableObject
/**
* {@inheritdoc}
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
return false;
}

View File

@ -28,7 +28,7 @@ class BlogHolder extends BlogTree implements MigratableObject
/**
* {@inheritdoc}
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
return false;
}
@ -64,7 +64,7 @@ class BlogHolder extends BlogTree implements MigratableObject
} else {
$message = "DRAFT: ";
}
return $message . $this->Title;
}
}

View File

@ -21,7 +21,7 @@ class BlogTree extends Page implements MigratableObject
/**
* {@inheritdoc}
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
return false;
}

View File

@ -27,7 +27,7 @@ class BlogFilter extends Lumberjack
$staged = parent::stageChildren($showAll);
if (!$this->shouldFilter() && $this->subclassForBlog() && !Permission::check('VIEW_DRAFT_CONTENT')) {
$stage = Versioned::current_stage();
$stage = Versioned::get_stage();
if ($stage == 'Stage') {
$stage = '';

View File

@ -1,12 +1,14 @@
<?php
use SilverStripe\ORM\DataExtension;
use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Versioning\Versioned;
use SilverStripe\ORM\Queries\SQLSelect;
use SilverStripe\Control\Controller;
use SilverStripe\Admin\LeftAndMain;
use SilverStripe\Security\Permission;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataExtension;
/**
* This is responsible for filtering only published posts to users who do not have permission to
@ -20,11 +22,11 @@ class BlogPostFilter extends DataExtension
/**
* Augment queries so that we don't fetch unpublished articles.
*
* @param SQLQuery $query
* @param SQLSelect $query
*/
public function augmentSQL(SQLQuery &$query)
public function augmentSQL(SQLSelect $query, DataQuery $dataQuery = null)
{
$stage = Versioned::current_stage();
$stage = Versioned::get_stage();
if (Controller::curr() instanceof LeftAndMain) {
return;

View File

@ -27,7 +27,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
if (!$record->isPublished()) {
/**
* @var SS_Datetime $lastEdited
* @var SilverStripe\ORM\FieldType\DBDatetime $lastEdited
*/
$lastEdited = $record->dbObject('LastEdited');
@ -42,7 +42,7 @@ class GridFieldBlogPostState extends GridFieldSiteTreeState
}
/**
* @var SS_Datetime $publishDate
* @var SilverStripe\ORM\FieldType\DBDatetime $publishDate
*/
$publishDate = $record->dbObject('PublishDate');

View File

@ -86,7 +86,7 @@ class BlogCategory extends DataObject implements CategorisationObject
/**
* {@inheritdoc}
*/
protected function validate()
public function validate()
{
$validation = parent::validate();
if($validation->valid()) {
@ -143,7 +143,7 @@ class BlogCategory extends DataObject implements CategorisationObject
*
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
$extended = $this->extendedCan(__FUNCTION__, $member);

View File

@ -44,7 +44,7 @@ class BlogPost extends Page
* @var array
*/
private static $db = array(
'PublishDate' => 'SS_Datetime',
'PublishDate' => 'Datetime',
'AuthorNames' => 'Varchar(1024)',
'Summary' => 'HTMLText',
);
@ -100,7 +100,7 @@ class BlogPost extends Page
*/
private static $casting = array(
'Excerpt' => 'HTMLText',
'Date' => 'SS_Datetime',
'Date' => 'Datetime',
);
/**
@ -430,7 +430,7 @@ class BlogPost extends Page
public function onBeforePublish()
{
/**
* @var SS_Datetime $publishDate
* @var SilverStripe\ORM\FieldType\DBDatetime $publishDate
*/
$publishDate = $this->dbObject('PublishDate');
@ -482,7 +482,7 @@ class BlogPost extends Page
}
/**
* @var SS_Datetime $publishDate
* @var SilverStripe\ORM\FieldType\DBDatetime $publishDate
*/
$publishDate = $this->dbObject('PublishDate');
if(!$publishDate->exists()) {
@ -581,7 +581,7 @@ class BlogPost extends Page
public function getMonthlyArchiveLink($type = 'day')
{
/**
* @var SS_Datetime $date
* @var SilverStripe\ORM\FieldType\DBDatetime $date
*/
$date = $this->dbObject('PublishDate');
@ -609,7 +609,7 @@ class BlogPost extends Page
public function getYearlyArchiveLink()
{
/**
* @var SS_Datetime $date
* @var SilverStripe\ORM\FieldType\DBDatetime $date
*/
$date = $this->dbObject('PublishDate');

View File

@ -87,7 +87,7 @@ class BlogTag extends DataObject implements CategorisationObject
/**
* {@inheritdoc}
*/
protected function validate()
public function validate()
{
$validation = parent::validate();
if($validation->valid()) {
@ -144,7 +144,7 @@ class BlogTag extends DataObject implements CategorisationObject
*
* @return bool
*/
public function canCreate($member = null)
public function canCreate($member = null, $context = [])
{
$extended = $this->extendedCan(__FUNCTION__, $member);