Merge pull request #280 from camfindlay/migrate

FIX Blog tag migration is per Blog
This commit is contained in:
Daniel Hensby 2015-06-29 09:35:50 +01:00 committed by Marco Kernler
commit 60b575b7bb
2 changed files with 7 additions and 5 deletions

View File

@ -38,7 +38,7 @@ class BlogEntry extends BlogPost implements MigratableObject {
//Migrate comma separated tags into BlogTag objects. //Migrate comma separated tags into BlogTag objects.
foreach($this->TagNames() as $tag) { foreach($this->TagNames() as $tag) {
$existingTag = BlogTag::get()->filter('Title', $tag); $existingTag = BlogTag::get()->filter(array('Title' => $tag, 'BlogID' => $this->ParentID));
if($existingTag->count()) { if($existingTag->count()) {
//if tag already exists we will simply add it to this post. //if tag already exists we will simply add it to this post.
$tagObject = $existingTag->First(); $tagObject = $existingTag->First();

View File

@ -106,15 +106,17 @@ class BlogArchiveWidget extends Widget {
/** /**
* @var BlogPost $post * @var BlogPost $post
*/ */
$date = new Date();
$date->setValue($post->PublishDate);
if($this->ArchiveType == 'Yearly') { if($this->ArchiveType == 'Yearly') {
$year = date('Y', strtotime($post->PublishDate)); $year = $date->FormatI18N("%Y");
$month = null; $month = null;
$title = $year; $title = $year;
} else { } else {
$year = date('Y', strtotime($post->PublishDate)); $year = $date->FormatI18N("%Y");
$month = date('m', strtotime($post->PublishDate)); $month = $date->FormatI18N("%m");
$title = date('F Y', strtotime($post->PublishDate)); $title = $date->FormatI18N("%B %Y");
} }
$archive->push(new ArrayData(array( $archive->push(new ArrayData(array(