From 44c0c8c25e40cb11eee13235b4f9c4020c3fa2a7 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Sat, 10 Sep 2016 15:30:32 +1200 Subject: [PATCH] FIX: PHP changes not automatically made by the upgrader. --- code/compat/pages/BlogEntry.php | 4 ++-- code/compat/pages/BlogHolder.php | 4 ++-- code/compat/pages/BlogTree.php | 2 +- code/extensions/BlogFilter.php | 2 +- code/extensions/BlogPostFilter.php | 12 +++++++----- code/forms/gridfield/GridFieldBlogPostState.php | 4 ++-- code/model/BlogCategory.php | 4 ++-- code/model/BlogPost.php | 12 ++++++------ code/model/BlogTag.php | 4 ++-- 9 files changed, 25 insertions(+), 23 deletions(-) diff --git a/code/compat/pages/BlogEntry.php b/code/compat/pages/BlogEntry.php index 190d475..cf1baf1 100644 --- a/code/compat/pages/BlogEntry.php +++ b/code/compat/pages/BlogEntry.php @@ -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; } diff --git a/code/compat/pages/BlogHolder.php b/code/compat/pages/BlogHolder.php index ee497ec..372f189 100644 --- a/code/compat/pages/BlogHolder.php +++ b/code/compat/pages/BlogHolder.php @@ -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; } } diff --git a/code/compat/pages/BlogTree.php b/code/compat/pages/BlogTree.php index 0998de2..4ba47e0 100644 --- a/code/compat/pages/BlogTree.php +++ b/code/compat/pages/BlogTree.php @@ -21,7 +21,7 @@ class BlogTree extends Page implements MigratableObject /** * {@inheritdoc} */ - public function canCreate($member = null) + public function canCreate($member = null, $context = []) { return false; } diff --git a/code/extensions/BlogFilter.php b/code/extensions/BlogFilter.php index e86e4e5..856b222 100644 --- a/code/extensions/BlogFilter.php +++ b/code/extensions/BlogFilter.php @@ -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 = ''; diff --git a/code/extensions/BlogPostFilter.php b/code/extensions/BlogPostFilter.php index 3a38123..2fb97a1 100644 --- a/code/extensions/BlogPostFilter.php +++ b/code/extensions/BlogPostFilter.php @@ -1,12 +1,14 @@ 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'); diff --git a/code/model/BlogCategory.php b/code/model/BlogCategory.php index 9c86275..83f104a 100644 --- a/code/model/BlogCategory.php +++ b/code/model/BlogCategory.php @@ -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); diff --git a/code/model/BlogPost.php b/code/model/BlogPost.php index dbe77ad..2d99ed4 100644 --- a/code/model/BlogPost.php +++ b/code/model/BlogPost.php @@ -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'); diff --git a/code/model/BlogTag.php b/code/model/BlogTag.php index 7b1c1c2..2614c0b 100644 --- a/code/model/BlogTag.php +++ b/code/model/BlogTag.php @@ -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);