Skip to content

Commit

Permalink
Fix for default stage being set to Live in SS3.1.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
camfindlay committed Jan 26, 2014
1 parent f5ec003 commit 38c1542
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion code/WpImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ protected function importPost($post) {
// so we can use update here.

$entry->update($post);
$entry->write();

//Create an initial write as a draft copy otherwise a write()
//in SS3.1.2+ will go live and never have a draft Version.
//@see http://doc.silverstripe.org/framework/en/changelogs/3.1.2#default-current-versioned-
//stage-to-live-rather-than-stage for details.
$entry->writeToStage('Stage');

//If the post was published on WP, now ensure it is also live in SS.
if ($post['IsPublished']){
$entry->publish("Stage", "Live");
}
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
}
],
"require": {
"silverstripe/framework": "~3.1",
"silverstripe/cms": "~3.1",
"silverstripe/framework": "~3.1.2",
"silverstripe/cms": "~3.1.2",
"silverstripe/blog": "*",
"silverstripe/comments": "*"
}
Expand Down

0 comments on commit 38c1542

Please sign in to comment.