From c0d302eb8e3d428b69f96ef76d69ce8c92eb3777 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 24 Feb 2015 11:17:03 +1300 Subject: [PATCH] Improve dev/build with obsolete class names --- code/model/Translatable.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/model/Translatable.php b/code/model/Translatable.php index efd9a5a..5abdde2 100755 --- a/code/model/Translatable.php +++ b/code/model/Translatable.php @@ -684,7 +684,7 @@ class Translatable extends DataExtension implements PermissionProvider { /** * @todo Find more appropriate place to hook into database building */ - function requireDefaultRecords() { + public function requireDefaultRecords() { // @todo This relies on the Locale attribute being on the base data class, and not any subclasses if($this->owner->class != ClassInfo::baseDataClass($this->owner->class)) return false; @@ -717,7 +717,7 @@ class Translatable extends DataExtension implements PermissionProvider { ))->column(); if(!$idsWithoutLocale) return; - if(class_exists('SiteTree') && $this->owner->class == 'SiteTree') { + if(class_exists('SiteTree') && $this->owner->class == 'SiteTree') { foreach(array('Stage', 'Live') as $stage) { foreach($idsWithoutLocale as $id) { $obj = Versioned::get_one_by_stage( @@ -725,7 +725,7 @@ class Translatable extends DataExtension implements PermissionProvider { $stage, sprintf('"SiteTree"."ID" = %d', $id) ); - if(!$obj) continue; + if(!$obj || $obj->ObsoleteClassName) continue; $obj->Locale = Translatable::default_locale(); $obj->writeToStage($stage); @@ -737,7 +737,7 @@ class Translatable extends DataExtension implements PermissionProvider { } else { foreach($idsWithoutLocale as $id) { $obj = DataObject::get_by_id($this->owner->class, $id); - if(!$obj) continue; + if(!$obj || $obj->ObsoleteClassName) continue; $obj->Locale = Translatable::default_locale(); $obj->write();