From f6c19793b74e50ff5c2e1922f2ecd9a65cb8b683 Mon Sep 17 00:00:00 2001 From: Morven Lewis-Everley Date: Fri, 27 Feb 2015 13:01:59 +0000 Subject: [PATCH] Remove migration related files as this commit is for templates --- code/compat/pages/BlogEntry.php | 72 ------------------------- code/compat/pages/BlogHolder.php | 37 ------------- code/compat/pages/BlogTree.php | 32 ----------- code/compat/tasks/BlogMigrationTask.php | 65 ---------------------- code/compat/tasks/MigratableObject.php | 9 ---- code/compat/widgets/ArchiveWidget.php | 28 ---------- code/compat/widgets/TagCloudWidget.php | 29 ---------- 7 files changed, 272 deletions(-) delete mode 100644 code/compat/pages/BlogEntry.php delete mode 100644 code/compat/pages/BlogHolder.php delete mode 100644 code/compat/pages/BlogTree.php delete mode 100644 code/compat/tasks/BlogMigrationTask.php delete mode 100644 code/compat/tasks/MigratableObject.php delete mode 100644 code/compat/widgets/ArchiveWidget.php delete mode 100644 code/compat/widgets/TagCloudWidget.php diff --git a/code/compat/pages/BlogEntry.php b/code/compat/pages/BlogEntry.php deleted file mode 100644 index 1d78954..0000000 --- a/code/compat/pages/BlogEntry.php +++ /dev/null @@ -1,72 +0,0 @@ - "SS_Datetime", - "Author" => "Text", - "Tags" => "Text" - ); - - /** - * Safely split and parse all distinct tags assigned to this BlogEntry - * - * @return array Associative array of lowercase tag to native case tags - * @deprecated since version 2.0 - */ - public function TagNames() { - $tags = preg_split("/\s*,\s*/", trim($this->Tags)); - $results = array(); - foreach($tags as $tag) { - if($tag) $results[mb_strtolower($tag)] = $tag; - } - return $results; - } - - public function canCreate($member = null) { - // Deprecated - return false; - } - - public function up() { - // Migrate tags - foreach($this->TagNames() as $tag) { - // Skip if tag already assigned - if($this->Tags()->filter('Title', $tag)->count()) continue; - - // Create tag - $tagObject = new BlogTag(); - $tagObject->Title = $tag; - $tagObject->BlogID = $this->ParentID; - $tagObject->write(); - $this->Tags()->add($tagObject); - } - - // Update fields - $this->PublishDate = $this->Date; - if($this->ClassName === 'BlogEntry') { - $this->ClassName = 'BlogPost'; - $this->write(); - } - } - - public function requireDefaultRecords() { - parent::requireDefaultRecords(); - - if(BlogMigrationTask::config()->run_during_dev_build) { - $task = new BlogMigrationTask(); - $task->up(); - } - } -} - -/** - * @deprecated since version 2.0 - */ -class BlogEntry_Controller extends BlogPost_Controller { -} diff --git a/code/compat/pages/BlogHolder.php b/code/compat/pages/BlogHolder.php deleted file mode 100644 index a3cd43e..0000000 --- a/code/compat/pages/BlogHolder.php +++ /dev/null @@ -1,37 +0,0 @@ - 'Boolean', - 'ShowFullEntry' => 'Boolean', - ); - - private static $has_one = array( - 'Owner' => 'Member', - ); - - public function canCreate($member = null) { - // Deprecated - return false; - } - - public function up() { - if($this->ClassName === 'BlogHolder') { - $this->ClassName = 'Blog'; - $this->write(); - } - } -} - -/** - * @deprecated since version 2.0 - */ -class BlogHolder_Controller extends BlogTree_Controller { - -} \ No newline at end of file diff --git a/code/compat/pages/BlogTree.php b/code/compat/pages/BlogTree.php deleted file mode 100644 index a6a3b2f..0000000 --- a/code/compat/pages/BlogTree.php +++ /dev/null @@ -1,32 +0,0 @@ - 'Varchar(255)', - 'LandingPageFreshness' => 'Varchar', - ); - - public function canCreate($member = null) { - // Deprecated - return false; - } - - public function up() { - if($this->ClassName === 'BlogTree') { - $this->ClassName = 'Blog'; - $this->write(); - } - } -} - -/** - * @deprecated since version 2.0 - */ -class BlogTree_Controller extends Blog_Controller { -} \ No newline at end of file diff --git a/code/compat/tasks/BlogMigrationTask.php b/code/compat/tasks/BlogMigrationTask.php deleted file mode 100644 index 81c6034..0000000 --- a/code/compat/tasks/BlogMigrationTask.php +++ /dev/null @@ -1,65 +0,0 @@ -message('Migrating legacy blog records'); - - foreach($classes as $class) { - // migrate objects in each stage - if(is_subclass_of($class, 'SiteTree')) { - foreach(array('Stage', 'Live') as $stage) { - $oldMode = Versioned::get_reading_mode(); - Versioned::reading_stage($stage); - $this->upClass($class, $stage); - Versioned::set_reading_mode($oldMode); - } - } else { - // Migrate object - $this->upClass($class); - } - } - } - - public function down() { - $this->message('BlogMigrationTask::down() not implemented'); - } - - /** - * Migrate records of a single class - * - * @param type $class - * @param type $stage - */ - protected function upClass($class, $stage = null) { - // Migrate all records - $items = $class::get(); - if($count = $items->count()) { - $stageMessage = " in stage {$stage}"; - $this->message("Migrating {$count} legacy {$class} records{$stageMessage}."); - foreach($items as $item) $item->up(); - } - } -} diff --git a/code/compat/tasks/MigratableObject.php b/code/compat/tasks/MigratableObject.php deleted file mode 100644 index 7870c04..0000000 --- a/code/compat/tasks/MigratableObject.php +++ /dev/null @@ -1,9 +0,0 @@ - 'Varchar' - ); - - private static $only_available_in = array('none'); - - public function canCreate($member = null) { - // Deprecated - return false; - } - - public function up() { - if($this->DisplayMode) { - $this->Type = ($this->DisplayMode === 'year') ? 'Yearly' : 'Monthly'; - } - $this->ClassName = 'BlogArchiveWidget'; - $this->write(); - } -} diff --git a/code/compat/widgets/TagCloudWidget.php b/code/compat/widgets/TagCloudWidget.php deleted file mode 100644 index cf9d55a..0000000 --- a/code/compat/widgets/TagCloudWidget.php +++ /dev/null @@ -1,29 +0,0 @@ - "Varchar", - "Limit" => "Int", - "Sortby" => "Varchar" - ); - - private static $only_available_in = array('none'); - - public function canCreate($member = null) { - // Deprecated - return false; - } - - public function up() { - $this->ClassName = 'BlogTagsWidget'; - $this->write(); - } -} \ No newline at end of file