Skip to content

Commit a6908df

Browse files
committed
stan
1 parent 902429c commit a6908df

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

‎inc/checkdatabasecommand.class.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
114114
);
115115
foreach ($tables_consistency['missing'] as $entry) {
116116
$output->writeln(sprintf(
117-
'-> container #%d (%s): expected table "%s" not found',
117+
__('-> container #%d (%s): expected table "%s" not found', 'fields'),
118118
$entry['container_id'],
119119
$entry['itemtype'],
120120
$entry['table'],

‎inc/container.class.php‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -995,16 +995,30 @@ public static function renameOversizedContainer(int $id, string $new_name): bool
995995
return false;
996996
}
997997

998-
$new_name = preg_replace('/[^\da-zA-Z]/', '', $new_name) ?? '';
999-
if ($new_name === '') {
1000-
Session::AddMessageAfterRedirect(__('Invalid name.', 'fields'), false, ERROR);
998+
$itemtypes = PluginFieldsToolbox::decodeJSONItemtypes($container->fields['itemtypes']);
999+
if (!is_array($itemtypes) || $itemtypes === []) {
1000+
Session::AddMessageAfterRedirect(__('No associated item type.', 'fields'), false, ERROR);
10011001

10021002
return false;
10031003
}
10041004

1005-
$itemtypes = PluginFieldsToolbox::decodeJSONItemtypes($container->fields['itemtypes']);
1006-
if (!is_array($itemtypes) || $itemtypes === []) {
1007-
Session::AddMessageAfterRedirect(__('No associated item type.', 'fields'), false, ERROR);
1005+
$is_oversized = false;
1006+
foreach ($itemtypes as $itemtype) {
1007+
if (strlen(getTableForItemType(self::getClassname($itemtype, $container->fields['name']))) > 64) {
1008+
$is_oversized = true;
1009+
break;
1010+
}
1011+
}
1012+
1013+
if (!$is_oversized) {
1014+
Session::AddMessageAfterRedirect(__('Container is not oversized.', 'fields'), false, ERROR);
1015+
1016+
return false;
1017+
}
1018+
1019+
$new_name = preg_replace('/[^\da-zA-Z]/', '', $new_name) ?? '';
1020+
if ($new_name === '') {
1021+
Session::AddMessageAfterRedirect(__('Invalid name.', 'fields'), false, ERROR);
10081022

10091023
return false;
10101024
}

0 commit comments

Comments
 (0)