- Issue created by @somebodysysop
- Status changed to Postponed: needs info
about 1 year ago 7:07am 5 December 2023 - π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Can you reproduce this by using layout builder the same way the person was on that day?
There is nothing in layout builder itself that does this but those contrib projects may be generating dummy files
- πΊπΈUnited States somebodysysop
The person is going to work on the site in the am. I will ask him to note the number of files in the Solr index before he starts and after, and what modules he uses.
- πΊπΈUnited States somebodysysop
Went through today and tried to duplicate the issue. Attached are results: https://www.drupal.org/files/issues/2023-12-05/2023-12-05%20activity%20l... β
Short of it, couldn't duplicate. The only significant difference I could glean is that on the 3rd, the theme was changed (upgraded/modified).
I also did a search for Contrib and Core modules that have generateSampleValue:
Contrib modules
[root@ip-172-31-13-94 modules]# grep -R generateSampleValue *
contrib/redirect/src/Plugin/Field/FieldType/RedirectSourceItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
contrib/devel/devel_generate/README.md:implement `\Drupal\Core\Field\FieldItemInterface::generateSampleValue()`.
contrib/devel/devel_generate/README.md:see: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!FieldItemIβ¦
contrib/entity_reference_revisions/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {If I remove the tests from Core results:
[root@ip-172-31-13-94 modules]# grep -R generateSampleValue *
comment/src/Plugin/Field/FieldType/CommentItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
datetime/src/Plugin/Field/FieldType/DateTimeItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
datetime_range/src/Plugin/Field/FieldType/DateRangeItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
file/src/Plugin/Field/FieldType/FileItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
file/src/Plugin/migrate/destination/EntityFile.php: $value = UriItem::generateSampleValue($field_definitions['uri']);
file/src/Plugin/migrate/destination/EntityFile.php: // generateSampleValue() wraps the value in an array.
file/tests/src/Kernel/FileItemTest.php: // Test the generateSampleValue() method.
image/src/Plugin/Field/FieldType/ImageItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
layout_builder/src/Plugin/Field/FieldType/LayoutSectionItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
link/src/Plugin/Field/FieldType/LinkItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
migrate/src/Plugin/migrate/destination/EntityContentBase.php: $values = $field_type_class::generateSampleValue($field_definition);
options/src/Plugin/Field/FieldType/ListItemBase.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
path/src/Plugin/Field/FieldType/PathItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
text/src/Plugin/Field/FieldType/TextItemBase.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
user/src/Plugin/migrate/destination/EntityUser.php: $name = UserNameItem::generateSampleValue($field_definitions['name']);
user/src/Plugin/migrate/destination/EntityUser.php: $mail = EmailItem::generateSampleValue($field_definitions['mail']);
user/src/StatusItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
user/src/TimeZoneItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
user/src/UserNameItem.php: public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
[root@ip-172-31-13-94 modules]#The site worked on is not open to the public yet, so the only activity that day and today was the essentially layout stuff.
Can anyone think of any circumstance where 50,000 sample files would be generated within the space of a few hours?
- π³πΏNew Zealand danielveza Brisbane, AU
This is indeed caused by FileItem::generateSampleValue.
This can be confirmed by:
- Installing a standard site
- Enable Layout builder on the page CT
- Add a file field to the page CT
- Edit the default layout and confirm that the file has been created on the server.
Out of the box a file should only be created by viewing the default layout of a content type that has a file field on it. That shouldn't generate 50,000 files in a few hours. There may be something else at play here with the paragraph setup. Do the paragraphs have file fields?
This seems like it's working by design, the only thought I have after trying to replicate and having a look at the code, I wonder if the file thats created in
::generateSampleValue
could be marked as a temporary file. That way the file will be garbage collected in the future. - πΊπΈUnited States somebodysysop
Yes, we do have at least one paragraph content type configured with file attachment fields.