From f042eda23d5a8bced614ca6271834ebb5be61a7a Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Tue, 31 Oct 2023 13:11:35 +0100 Subject: [PATCH 01/12] Changed maxFileSize value type to float --- src/lib/FieldType/Image/Type.php | 6 +++--- .../Legacy/Content/FieldValue/Converter/ImageConverter.php | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index ef84995998..56ae58f61f 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -24,7 +24,7 @@ class Type extends FieldType implements TranslationContainerInterface protected $validatorConfigurationSchema = [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', + 'type' => 'float', 'default' => null, ], ], @@ -233,14 +233,14 @@ public function validateValidatorConfiguration($validatorConfiguration) ); break; } - if (!is_int($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { + if (!is_float($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { $validationErrors[] = new ValidationError( 'Validator %validator% expects parameter %parameter% to be of %type%.', null, [ '%validator%' => $validatorIdentifier, '%parameter%' => 'maxFileSize', - '%type%' => 'integer', + '%type%' => 'float', ], "[$validatorIdentifier][maxFileSize]" ); diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 0b06c09c40..0250c0f873 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -183,7 +183,9 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField { $validators = $fieldDef->fieldTypeConstraints->validators; - $storageDef->dataInt1 = $validators['FileSizeValidator']['maxFileSize'] ?? 0; + $storageDef->dataInt1 = isset($validators['FileSizeValidator']['maxFileSize']) + ? $validators['FileSizeValidator']['maxFileSize'] * 1024 + : 0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); } @@ -193,7 +195,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin [ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => $storageDef->dataInt1 !== 0 ? $storageDef->dataInt1 : null, + 'maxFileSize' => $storageDef->dataInt1 !== 0 ? $storageDef->dataInt1 / 1024 : null, ], 'AlternativeTextValidator' => [ 'required' => (bool)$storageDef->dataInt2, From 374708ab61c85c6a556c5b857165a052d71ac20b Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Tue, 31 Oct 2023 13:11:54 +0100 Subject: [PATCH 02/12] [Tests] Fixed tests --- .../Core/Repository/FieldType/ImageIntegrationTest.php | 4 ++-- .../Core/Repository/_fixtures/Legacy/data/test_data.yaml | 4 ++-- tests/lib/FieldType/ImageTest.php | 4 ++-- .../Persistence/FieldValue/Converter/ImageConverterTest.php | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php index ff9555acc0..914d7f1888 100644 --- a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php @@ -112,7 +112,7 @@ public function getValidatorSchema() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', + 'type' => 'float', 'default' => false, ], ], @@ -134,7 +134,7 @@ public function getValidValidatorConfiguration() { return [ 'FileSizeValidator' => [ - 'maxFileSize' => 2 * 1024 * 1024, // 2 MB + 'maxFileSize' => 2.0, ], 'AlternativeTextValidator' => [ 'required' => true, diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml index 6611e9f474..fac959a370 100644 --- a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml +++ b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml @@ -92,7 +92,7 @@ ezcontentclass_attribute: - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: MailSettings, data_text3: AdminEmail, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 177, identifier: email, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Email";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: SiteURL, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 178, identifier: siteurl, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 7, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:8:"Site URL";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 10, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: eztext, id: 179, identifier: signature, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 4, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Signature";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1024, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'New article', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 181, identifier: title, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 182, identifier: short_title, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:11:"Short title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezauthor, id: 183, identifier: author, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:6:"Author";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -132,7 +132,7 @@ ezcontentclass_attribute: - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 234, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezcomcomments, id: 235, identifier: comments, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Comments";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 150, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 236, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2048, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 240, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 241, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezurl, id: 243, identifier: location, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Location";s:16:"always-available";s:6:"eng-GB";}', version: 0 } diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index 126639d1e1..97cf350438 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -112,7 +112,7 @@ protected function getValidatorConfigurationSchemaExpectation() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'int', + 'type' => 'float', 'default' => null, ], ], @@ -561,7 +561,7 @@ public function provideValidDataForValidate() [ 'validatorConfiguration' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1, + 'maxFileSize' => 1.0, ], ], ], diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index b14eb6e415..ad59d8fec9 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -74,13 +74,13 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable 'fieldTypeConstraints' => new FieldTypeConstraints([ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1024, + 'maxFileSize' => 1024.0, ], ], ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 1024, + 'dataInt1' => 1048576, 'dataInt2' => 0, ]), ]; @@ -165,7 +165,7 @@ public function dataProviderForTestToFieldDefinition(): iterable 'fieldTypeConstraints' => new FieldTypeConstraints([ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1024, + 'maxFileSize' => 1.0, ], 'AlternativeTextValidator' => [ 'required' => true, From 6c7ee6869a939acb9cd1708140c15ff631b016c2 Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Thu, 2 Nov 2023 11:26:21 +0100 Subject: [PATCH 03/12] [DB] Updated schema --- data/mysql/cleandata.sql | 4 ++-- data/postgresql/cleandata.sql | 4 ++-- .../Repository/_fixtures/Legacy/data/test_data.yaml | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/data/mysql/cleandata.sql b/data/mysql/cleandata.sql index ee9d49f63b..478a385dbd 100644 --- a/data/mysql/cleandata.sql +++ b/data/mysql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,0,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:12:\"User account\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,0,1,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Name\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,0,2,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:7:\"Caption\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), + (1,'',5,0,0,0,0,10240,0,0,0,'KB','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,0,3,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:17:\"Short description\";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Intro\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,0,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Body\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,0,2,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:10:\"Short name\";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,0,4,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:11:\"Description\";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:9:\"Signature\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',4,0,0,0,0,10,0,0,0,'','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); + (1,'',4,0,0,0,0,10240,0,0,0,'KB','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); INSERT INTO `ezcontentclass_classgroup` (`contentclass_id`, `contentclass_version`, `group_id`, `group_name`) VALUES (1, 0, 1, 'Content'), diff --git a/data/postgresql/cleandata.sql b/data/postgresql/cleandata.sql index bb4df5f6d8..859a22e2c3 100644 --- a/data/postgresql/cleandata.sql +++ b/data/postgresql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,FALSE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:12:"User account";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,FALSE,1,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,FALSE,2,NULL,NULL,'a:2:{s:6:"eng-GB";s:7:"Caption";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), + (1,'',5,0,0,0,0,10240,0,0,0,'KB','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,FALSE,3,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:17:"Short description";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Intro";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,FALSE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Body";s:16:"always-available";s:6:"eng-GB";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,FALSE,2,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:10:"Short name";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,FALSE,4,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:11:"Description";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:9:"Signature";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',4,0,0,0,0,10,0,0,0,'','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); + (1,'',4,0,0,0,0,10240,0,0,0,'KB','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); INSERT INTO "ezcontentclass_classgroup" ("contentclass_id", "contentclass_version", "group_id", "group_name") VALUES (1,0,1,'Content'), diff --git a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml index fac959a370..62e092cdcd 100644 --- a/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml +++ b/tests/integration/Core/Repository/_fixtures/Legacy/data/test_data.yaml @@ -87,16 +87,16 @@ ezcontentclass_attribute: - { can_translate: 0, category: '', contentclass_id: 14, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 6, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: image.ini, data_text2: large, data_text3: Filters, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 171, identifier: imagelarge, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 13, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:16:"Image Large Size";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: SiteName, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 172, identifier: title, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 1, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Title";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 6, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: MetaDataArray, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 173, identifier: meta_data, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 2, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Meta data";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 174, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 174, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: sitestyle, data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezpackage, id: 175, identifier: sitestyle, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 4, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Sitestyle";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: MailSettings, data_text3: AdminEmail, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 177, identifier: email, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Email";}', version: 0 } - { can_translate: 0, category: '', contentclass_id: 15, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: site.ini, data_text2: SiteSettings, data_text3: SiteURL, data_text4: '', data_text5: override;user;admin;demo, data_type_string: ezinisetting, id: 178, identifier: siteurl, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 7, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:8:"Site URL";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 10, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: eztext, id: 179, identifier: signature, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 4, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:9:"Signature";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1024, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 4, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 1024, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 180, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_description_list: 'a:2:{i:0;s:0:"";s:16:"always-available";b:0;}', serialized_name_list: 'a:2:{s:16:"always-available";s:6:"eng-US";s:6:"eng-US";s:5:"Image";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'New article', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 181, identifier: title, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 182, identifier: short_title, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:11:"Short title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezauthor, id: 183, identifier: author, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:6:"Author";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 186, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 186, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezdatetime, id: 188, identifier: publish_date, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 8, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:12:"Publish date";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 190, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 10, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 16, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezgmaplocation, id: 191, identifier: location, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 11, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Location";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -110,7 +110,7 @@ ezcontentclass_attribute: - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 201, identifier: name, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 202, identifier: product_number, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:14:"Product number";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezfloat, id: 205, identifier: price, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Price";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 206, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 206, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezmultioption, id: 208, identifier: additional_options, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 8, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:18:"Additional options";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 210, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 10, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 19, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezcomcomments, id: 211, identifier: comments, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 11, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Comments";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -132,7 +132,7 @@ ezcontentclass_attribute: - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 234, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 24, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezcomcomments, id: 235, identifier: comments, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 6, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Comments";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 150, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 236, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2048, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 2048, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 238, identifier: image, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 25, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 240, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:2:{s:6:"eng-GB";s:0:"";s:16:"always-available";s:6:"eng-GB";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 255, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 241, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 26, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezurl, id: 243, identifier: location, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:8:"Location";s:16:"always-available";s:6:"eng-GB";}', version: 0 } @@ -157,7 +157,7 @@ ezcontentclass_attribute: - { can_translate: 0, category: '', contentclass_id: 32, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: "\n\n", data_type_string: ezselection, id: 266, identifier: view, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:1:{s:6:"eng-GB";s:0:"";}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"View";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 267, identifier: name, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 268, identifier: url, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 2, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:3:"URL";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 269, identifier: image, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } + - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: 'KB', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezimage, id: 269, identifier: image, is_information_collector: 0, is_required: 1, is_searchable: 0, placement: 3, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 10, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: eztext, id: 270, identifier: image_map, is_information_collector: 0, is_required: 0, is_searchable: 0, placement: 4, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:9:"Image map";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 33, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezkeyword, id: 271, identifier: tags, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 5, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:4:"Tags";s:16:"always-available";s:6:"eng-GB";}', version: 0 } - { can_translate: 1, category: '', contentclass_id: 34, data_float1: 0, data_float2: 0, data_float3: 0, data_float4: 0, data_int1: 0, data_int2: 0, data_int3: 0, data_int4: 0, data_text1: '', data_text2: '', data_text3: '', data_text4: '', data_text5: '', data_type_string: ezstring, id: 272, identifier: title, is_information_collector: 0, is_required: 0, is_searchable: 1, placement: 1, serialized_data_text: 'a:0:{}', serialized_description_list: 'a:0:{}', serialized_name_list: 'a:2:{s:6:"eng-GB";s:5:"Title";s:16:"always-available";s:6:"eng-GB";}', version: 0 } From bba7da55f9c5eb8910532b73bd4bd0e70b7da93d Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Thu, 2 Nov 2023 11:51:51 +0100 Subject: [PATCH 04/12] Added max file size unit to storage dataText1 column --- .../Legacy/Content/FieldValue/Converter/ImageConverter.php | 1 + .../Persistence/FieldValue/Converter/ImageConverterTest.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 0250c0f873..cea4999d43 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -187,6 +187,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField ? $validators['FileSizeValidator']['maxFileSize'] * 1024 : 0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); + $storageDef->dataText1 = 'KB'; } public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index ad59d8fec9..8247534445 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -66,6 +66,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; @@ -82,6 +83,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 1048576, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; @@ -98,6 +100,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 1, + 'dataText1' => 'KB', ]), ]; @@ -114,6 +117,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataInt1' => 0, 'dataInt2' => 0, + 'dataText1' => 'KB', ]), ]; } From 22d56dbde36f48aa9ee252f2297c31e5897b41fb Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 22 Nov 2023 08:36:05 +0100 Subject: [PATCH 05/12] Fixed FileSizeValidator type that caused existing migrations to fail --- src/lib/FieldType/Image/Type.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index 56ae58f61f..3dfc44dadb 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -24,7 +24,7 @@ class Type extends FieldType implements TranslationContainerInterface protected $validatorConfigurationSchema = [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'float', + 'type' => 'numeric', 'default' => null, ], ], @@ -134,7 +134,7 @@ protected function checkValueStructure(BaseValue $value) ); } - if (isset($value->fileSize) && (!is_int($value->fileSize) || $value->fileSize < 0)) { + if (isset($value->fileSize) && (!is_float($value->fileSize) || $value->fileSize < 0)) { throw new InvalidArgumentType( '$value->fileSize', 'int', @@ -233,14 +233,14 @@ public function validateValidatorConfiguration($validatorConfiguration) ); break; } - if (!is_float($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { + if (!is_numeric($parameters['maxFileSize']) && $parameters['maxFileSize'] !== null) { $validationErrors[] = new ValidationError( 'Validator %validator% expects parameter %parameter% to be of %type%.', null, [ '%validator%' => $validatorIdentifier, '%parameter%' => 'maxFileSize', - '%type%' => 'float', + '%type%' => 'numeric', ], "[$validatorIdentifier][maxFileSize]" ); From c1dde8dcc643db28baae613bf40106d4553b7978 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 22 Nov 2023 08:46:53 +0100 Subject: [PATCH 06/12] Fixed file size validation --- src/lib/FieldType/Image/Type.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index 3dfc44dadb..bfa06bb97e 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -134,11 +134,11 @@ protected function checkValueStructure(BaseValue $value) ); } - if (isset($value->fileSize) && (!is_float($value->fileSize) || $value->fileSize < 0)) { + if (isset($value->fileSize) && ((!is_int($value->fileSize) && !is_float($value->fileSize)) || $value->fileSize < 0)) { throw new InvalidArgumentType( '$value->fileSize', - 'int', - $value->alternativeText + 'int|float', + $value->fileSize ); } From def1a9368592bb9c13fe273e42a2283ab2295096 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 22 Nov 2023 08:47:07 +0100 Subject: [PATCH 07/12] Fixed ImageType tests --- tests/lib/FieldType/ImageTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/FieldType/ImageTest.php b/tests/lib/FieldType/ImageTest.php index 97cf350438..042d400141 100644 --- a/tests/lib/FieldType/ImageTest.php +++ b/tests/lib/FieldType/ImageTest.php @@ -112,7 +112,7 @@ protected function getValidatorConfigurationSchemaExpectation() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'float', + 'type' => 'numeric', 'default' => null, ], ], From fa1a8a0903986d0e3bf37c3225f3e44e5cd53d97 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Wed, 22 Nov 2023 09:01:54 +0100 Subject: [PATCH 08/12] Adjusted integration tests --- .../Core/Repository/FieldType/ImageIntegrationTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php index 914d7f1888..c3594c8055 100644 --- a/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/ImageIntegrationTest.php @@ -112,8 +112,8 @@ public function getValidatorSchema() return [ 'FileSizeValidator' => [ 'maxFileSize' => [ - 'type' => 'float', - 'default' => false, + 'type' => 'numeric', + 'default' => null, ], ], 'AlternativeTextValidator' => [ From 312574ab9aa2941579336a328bb143c838b0e243 Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Thu, 30 Nov 2023 13:03:16 +0100 Subject: [PATCH 09/12] Changed field to store max file size from dataInt1 to dataFloat1 --- .../Content/FieldValue/Converter/ImageConverter.php | 4 ++-- .../FieldValue/Converter/ImageConverterTest.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index cea4999d43..9795488e0b 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -183,7 +183,7 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField { $validators = $fieldDef->fieldTypeConstraints->validators; - $storageDef->dataInt1 = isset($validators['FileSizeValidator']['maxFileSize']) + $storageDef->dataFloat1 = isset($validators['FileSizeValidator']['maxFileSize']) ? $validators['FileSizeValidator']['maxFileSize'] * 1024 : 0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); @@ -196,7 +196,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin [ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => $storageDef->dataInt1 !== 0 ? $storageDef->dataInt1 / 1024 : null, + 'maxFileSize' => $storageDef->dataFloat1 !== 0 ? $storageDef->dataFloat1 / 1024 : null, ], 'AlternativeTextValidator' => [ 'required' => (bool)$storageDef->dataInt2, diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index 8247534445..6cf65688f5 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -64,7 +64,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, 'dataText1' => 'KB', ]), @@ -81,7 +81,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 1048576, + 'dataFloat1' => 1048576.0, 'dataInt2' => 0, 'dataText1' => 'KB', ]), @@ -98,7 +98,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 1, 'dataText1' => 'KB', ]), @@ -115,7 +115,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable ]), ]), new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, 'dataText1' => 'KB', ]), @@ -143,7 +143,7 @@ public function dataProviderForTestToFieldDefinition(): iterable { yield [ new StorageFieldDefinition([ - 'dataInt1' => 0, + 'dataFloat1' => 0.0, 'dataInt2' => 0, ]), new FieldDefinition([ @@ -162,7 +162,7 @@ public function dataProviderForTestToFieldDefinition(): iterable yield [ new StorageFieldDefinition([ - 'dataInt1' => 1024, + 'dataFloat1' => 1024.0, 'dataInt2' => 1, ]), new FieldDefinition([ From 8ce3b1f44fcc239d0d0b971141f77629c3d71b0e Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Fri, 1 Dec 2023 08:46:25 +0100 Subject: [PATCH 10/12] Adjusted cleandata to store max file size in dataFloat1 column --- data/mysql/cleandata.sql | 4 ++-- data/postgresql/cleandata.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/data/mysql/cleandata.sql b/data/mysql/cleandata.sql index 478a385dbd..09be34d2a1 100644 --- a/data/mysql/cleandata.sql +++ b/data/mysql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,0,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:12:\"User account\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,0,1,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Name\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,0,2,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:7:\"Caption\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',5,0,0,0,0,10240,0,0,0,'KB','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), + (1,'',5,10.0,0,0,0,0,0,0,0,'MB','','','',NULL,'ezimage',118,'image',0,0,0,1,3,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,0,3,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:17:\"Short description\";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Intro\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,0,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:4:\"Body\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,0,2,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:10:\"Short name\";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,0,4,'N;','a:0:{}','a:1:{s:6:\"eng-GB\";s:11:\"Description\";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,0,4,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:9:\"Signature\";s:16:\"always-available\";s:6:\"eng-GB\";}',0), - (1,'',4,0,0,0,0,10240,0,0,0,'KB','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); + (1,'',4,10.0,0,0,0,0,0,0,0,'MB','','','','','ezimage',180,'image',0,0,0,1,5,NULL,NULL,'a:2:{s:6:\"eng-GB\";s:5:\"Image\";s:16:\"always-available\";s:6:\"eng-GB\";}',0); INSERT INTO `ezcontentclass_classgroup` (`contentclass_id`, `contentclass_version`, `group_id`, `group_name`) VALUES (1, 0, 1, 'Content'), diff --git a/data/postgresql/cleandata.sql b/data/postgresql/cleandata.sql index 859a22e2c3..fadaa1e7ea 100644 --- a/data/postgresql/cleandata.sql +++ b/data/postgresql/cleandata.sql @@ -47,7 +47,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (0,'',4,0,0,0,0,7,10,0,0,'','^[^@]+$','','','','ezuser',12,'user_account',0,1,0,FALSE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:12:"User account";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,150,0,0,0,'','','','',NULL,'ezstring',116,'name',0,1,1,FALSE,1,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Name";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',5,0,0,0,0,10,0,0,0,'','','','',NULL,'ezrichtext',117,'caption',0,0,1,FALSE,2,NULL,NULL,'a:2:{s:6:"eng-GB";s:7:"Caption";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',5,0,0,0,0,10240,0,0,0,'KB','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), + (1,'',5,10.0,0,0,0,0,0,0,0,'MB','','','',NULL,'ezimage',118,'image',0,0,0,TRUE,3,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',1,NULL,NULL,NULL,NULL,5,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',119,'short_description',0,0,1,FALSE,3,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:17:"Short description";}',0), (1,'',2,0,0,0,0,10,0,0,0,'','','','','','ezrichtext',120,'intro',0,1,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Intro";s:16:"always-available";s:6:"eng-GB";}',0), (1,'',2,0,0,0,0,20,0,0,0,'','','','','','ezrichtext',121,'body',0,0,1,FALSE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:4:"Body";s:16:"always-available";s:6:"eng-GB";}',0), @@ -61,7 +61,7 @@ VALUES (1,'',2,0,0,0,0,255,0,0,0,'New article','','','','','ezstring',1,'title', (1,'',1,NULL,NULL,NULL,NULL,100,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezstring',155,'short_name',0,0,1,FALSE,2,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:10:"Short name";}',0), (1,'',1,NULL,NULL,NULL,NULL,20,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'ezrichtext',156,'description',0,0,1,FALSE,4,'N;','a:0:{}','a:1:{s:6:"eng-GB";s:11:"Description";}',0), (1,'',4,0,0,0,0,10,0,0,0,'','','','','','eztext',179,'signature',0,0,1,FALSE,4,NULL,NULL,'a:2:{s:6:"eng-GB";s:9:"Signature";s:16:"always-available";s:6:"eng-GB";}',0), - (1,'',4,0,0,0,0,10240,0,0,0,'KB','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); + (1,'',4,10.0,0,0,0,0,0,0,0,'MB','','','','','ezimage',180,'image',0,0,0,TRUE,5,NULL,NULL,'a:2:{s:6:"eng-GB";s:5:"Image";s:16:"always-available";s:6:"eng-GB";}',0); INSERT INTO "ezcontentclass_classgroup" ("contentclass_id", "contentclass_version", "group_id", "group_name") VALUES (1,0,1,'Content'), From 8cb355b4615fffff6d36c762feba194caa6db1d6 Mon Sep 17 00:00:00 2001 From: Tomasz Kryszan Date: Fri, 1 Dec 2023 08:46:53 +0100 Subject: [PATCH 11/12] Dropped converting max file size from MB to KB --- .../FieldValue/Converter/ImageConverter.php | 8 +++----- .../FieldValue/Converter/ImageConverterTest.php | 14 +++++++------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php index 9795488e0b..436bcc6f87 100644 --- a/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php +++ b/src/lib/Persistence/Legacy/Content/FieldValue/Converter/ImageConverter.php @@ -183,11 +183,9 @@ public function toStorageFieldDefinition(FieldDefinition $fieldDef, StorageField { $validators = $fieldDef->fieldTypeConstraints->validators; - $storageDef->dataFloat1 = isset($validators['FileSizeValidator']['maxFileSize']) - ? $validators['FileSizeValidator']['maxFileSize'] * 1024 - : 0; + $storageDef->dataFloat1 = $validators['FileSizeValidator']['maxFileSize'] ?? 0.0; $storageDef->dataInt2 = (int)($validators['AlternativeTextValidator']['required'] ?? 0); - $storageDef->dataText1 = 'KB'; + $storageDef->dataText1 = 'MB'; } public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefinition $fieldDef): void @@ -196,7 +194,7 @@ public function toFieldDefinition(StorageFieldDefinition $storageDef, FieldDefin [ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => $storageDef->dataFloat1 !== 0 ? $storageDef->dataFloat1 / 1024 : null, + 'maxFileSize' => $storageDef->dataFloat1 !== 0.0 ? $storageDef->dataFloat1 : null, ], 'AlternativeTextValidator' => [ 'required' => (bool)$storageDef->dataInt2, diff --git a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php index 6cf65688f5..5f03edb553 100644 --- a/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php +++ b/tests/lib/Persistence/FieldValue/Converter/ImageConverterTest.php @@ -66,7 +66,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataFloat1' => 0.0, 'dataInt2' => 0, - 'dataText1' => 'KB', + 'dataText1' => 'MB', ]), ]; @@ -75,15 +75,15 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable 'fieldTypeConstraints' => new FieldTypeConstraints([ 'validators' => [ 'FileSizeValidator' => [ - 'maxFileSize' => 1024.0, + 'maxFileSize' => 1.0, ], ], ]), ]), new StorageFieldDefinition([ - 'dataFloat1' => 1048576.0, + 'dataFloat1' => 1.0, 'dataInt2' => 0, - 'dataText1' => 'KB', + 'dataText1' => 'MB', ]), ]; @@ -100,7 +100,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataFloat1' => 0.0, 'dataInt2' => 1, - 'dataText1' => 'KB', + 'dataText1' => 'MB', ]), ]; @@ -117,7 +117,7 @@ public function dataProviderForTestToStorageFieldDefinition(): iterable new StorageFieldDefinition([ 'dataFloat1' => 0.0, 'dataInt2' => 0, - 'dataText1' => 'KB', + 'dataText1' => 'MB', ]), ]; } @@ -162,7 +162,7 @@ public function dataProviderForTestToFieldDefinition(): iterable yield [ new StorageFieldDefinition([ - 'dataFloat1' => 1024.0, + 'dataFloat1' => 1.0, 'dataInt2' => 1, ]), new FieldDefinition([ From 00a454e928512c671816a1a5ddabf75657690494 Mon Sep 17 00:00:00 2001 From: ciastektk Date: Mon, 4 Dec 2023 11:55:12 +0100 Subject: [PATCH 12/12] Changed invalid argument type name to numeric for file size value --- src/lib/FieldType/Image/Type.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/FieldType/Image/Type.php b/src/lib/FieldType/Image/Type.php index bfa06bb97e..6345fec17b 100644 --- a/src/lib/FieldType/Image/Type.php +++ b/src/lib/FieldType/Image/Type.php @@ -137,7 +137,7 @@ protected function checkValueStructure(BaseValue $value) if (isset($value->fileSize) && ((!is_int($value->fileSize) && !is_float($value->fileSize)) || $value->fileSize < 0)) { throw new InvalidArgumentType( '$value->fileSize', - 'int|float', + 'numeric', $value->fileSize ); }