From a25668eba0dbdf004b6fc3a02255a900783e1f97 Mon Sep 17 00:00:00 2001 From: Dylan Wagstaff Date: Mon, 29 Jan 2018 15:26:16 +1300 Subject: [PATCH] Remove SS 2.x upgrade code that runs every build --- docs/en/Installing.md | 8 +------- src/Model/Comment.php | 33 --------------------------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/docs/en/Installing.md b/docs/en/Installing.md index 0537750..9424bf8 100644 --- a/docs/en/Installing.md +++ b/docs/en/Installing.md @@ -12,10 +12,4 @@ Then run a database rebuild by visiting `dev/build`. This will add the required Out of the box the module adds commenting support to all pages on your site. This functionality can be turned on and off on a per page basis in the CMS under the `Behaviour` tab for a given page. Once the `Allow Comments` checkbox is ticked, republish and view the webpage. -For more configuration options see [Configuration](Configuration.md). - -## Upgrading - -### Migrating from version SilverStripe 2 installations - -This module replaces the built-in commenting system available in SilverStripe 2. Running the `dev/build` task will automatically perform a migration if any comments from these old versions exist. +For more configuration options see [Configuration](Configuration.md). \ No newline at end of file diff --git a/src/Model/Comment.php b/src/Model/Comment.php index 6b7e610..dacfddf 100755 --- a/src/Model/Comment.php +++ b/src/Model/Comment.php @@ -181,39 +181,6 @@ class Comment extends DataObject return Injector::inst()->createWithArgs(SecurityToken::class, array($this)); } - /** - * Migrates the old {@link PageComment} objects to {@link Comment} - */ - public function requireDefaultRecords() - { - parent::requireDefaultRecords(); - - // Upgrade from SilverStripe 2 version if necessary - if (DB::get_schema()->hasTable('PageComment')) { - $comments = DB::query('SELECT * FROM "PageComment"'); - - if ($comments) { - while ($pageComment = $comments->next()) { - // create a new comment from the older page comment - $comment = new Comment(); - $comment->update($pageComment); - - // set the variables which have changed - $comment->BaseClass = SiteTree::class; - $comment->URL = (isset($pageComment['CommenterURL'])) ? $pageComment['CommenterURL'] : ''; - if ((int) $pageComment['NeedsModeration'] == 0) { - $comment->Moderated = true; - } - - $comment->write(); - } - } - - DB::alteration_message('Migrated PageComment to Comment', 'changed'); - DB::get_schema()->dontRequireTable('PageComment'); - } - } - /** * Return a link to this comment *