diff --git a/code/WpImporter.php b/code/WpImporter.php index a4c8766..ca8466d 100644 --- a/code/WpImporter.php +++ b/code/WpImporter.php @@ -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"); } diff --git a/composer.json b/composer.json index f0527bb..64c832f 100644 --- a/composer.json +++ b/composer.json @@ -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": "*" }