Skip to content

Commit 91b1504

Browse files
committed
Fix fields renaming
fixes #605
1 parent 1e47225 commit 91b1504

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

inc/toolbox.class.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,22 @@ public function fixFieldsNames(Migration $migration, $condition)
100100
{
101101
global $DB;
102102

103-
$bad_named_fields = $DB->request(
103+
$bad_named_fields = [];
104+
$fields = $DB->request(
104105
[
105106
'FROM' => PluginFieldsField::getTable(),
106-
'WHERE' => [
107-
'name' => [
108-
'REGEXP',
109-
$DB->escape('[0-9]+')
110-
],
111-
$condition,
112-
],
107+
'WHERE' => $condition,
113108
]
114109
);
110+
foreach ($fields as $field) {
111+
$field_copy = $field;
112+
unset($field_copy['name']);
113+
if ($field['name'] !== (new PluginFieldsField())->prepareName($field_copy)) {
114+
$bad_named_fields[] = $field;
115+
}
116+
}
115117

116-
if ($bad_named_fields->count() === 0) {
118+
if (count($bad_named_fields) === 0) {
117119
return;
118120
}
119121

0 commit comments

Comments
 (0)