diff --git a/ORM/DatabaseAdmin.php b/ORM/DatabaseAdmin.php
index 045a6addd..43e4ec26d 100644
--- a/ORM/DatabaseAdmin.php
+++ b/ORM/DatabaseAdmin.php
@@ -37,6 +37,20 @@ class DatabaseAdmin extends Controller {
'import'
);
+ /**
+ * Obsolete classname values that should be remapped in dev/build
+ */
+ private static $classname_value_remapping = [
+ 'Group' => 'SilverStripe\\Security\\Group',
+ 'LoginAttempt' => 'SilverStripe\\Security\\LoginAttempt',
+ 'Member' => 'SilverStripe\\Security\\Member',
+ 'MemberPassword' => 'SilverStripe\\Security\\MemberPassword',
+ 'Permission' => 'SilverStripe\\Security\\Permission',
+ 'PermissionRole' => 'SilverStripe\\Security\\PermissionRole',
+ 'PermissionRoleCode' => 'SilverStripe\\Security\\PermissionRoleCode',
+ 'RememberLoginHash' => 'SilverStripe\\Security\\RememberLoginHash',
+ ];
+
protected function init() {
parent::init();
@@ -159,7 +173,7 @@ class DatabaseAdmin extends Controller {
public function buildDefaults() {
$dataClasses = ClassInfo::subclassesFor('SilverStripe\ORM\DataObject');
array_shift($dataClasses);
- foreach($dataClasses as $dataClass){
+ foreach($dataClasses as $dataClass) {
singleton($dataClass)->requireDefaultRecords();
print "Defaults loaded for $dataClass
";
}
@@ -281,6 +295,19 @@ class DatabaseAdmin extends Controller {
singleton($dataClass)->requireDefaultRecords();
}
}
+
+ // Remap obsolete class names
+ $schema = DataObject::getSchema();
+ foreach ($this->config()->classname_value_remapping as $oldClassName => $newClassName) {
+ $badRecordCount = $newClassName::get()->filter(["ClassName" => $oldClassName ])->count();
+ if($badRecordCount > 0) {
+ if(Director::is_cli()) echo " * Correcting $badRecordCount obsolete classname values for $newClassName\n";
+ else echo "