diff --git a/core/modules/file/file.module b/core/modules/file/file.module index 73282f0fdf..0802f1e341 100644 --- a/core/modules/file/file.module +++ b/core/modules/file/file.module @@ -1426,8 +1426,12 @@ function file_managed_file_save_upload($element, FormStateInterface $form_state) $upload_name = implode('_', $element['#parents']); $all_files = \Drupal::request()->files->get('files', []); if (empty($all_files[$upload_name])) { + \Drupal::logger('file')->notice('Exiting file_managed_file_save_upload at line 1430.'); return FALSE; } + else { + \Drupal::logger('file')->notice('File info in file_managed_file_save_upload: ' . serialize($all_files[$upload_name])); + } $file_upload = $all_files[$upload_name]; $destination = isset($element['#upload_location']) ? $element['#upload_location'] : NULL; diff --git a/core/modules/file/src/Element/ManagedFile.php b/core/modules/file/src/Element/ManagedFile.php index 06bf2e62a1..d698b73aaa 100644 --- a/core/modules/file/src/Element/ManagedFile.php +++ b/core/modules/file/src/Element/ManagedFile.php @@ -149,7 +149,7 @@ public static function valueCallback(&$element, $input, FormStateInterface $form // Confirm that the file exists when used as a default value. if (!empty($default_fids)) { - \Drupal::logger('file')->notice('empty $default_fids'); + \Drupal::logger('file')->notice('!empty $default_fids'); $fids = []; foreach ($default_fids as $fid) { if ($file = File::load($fid)) { diff --git a/core/modules/media_library/src/Form/FileUploadForm.php b/core/modules/media_library/src/Form/FileUploadForm.php index 2cb3e9d5be..b8e68cb767 100644 --- a/core/modules/media_library/src/Form/FileUploadForm.php +++ b/core/modules/media_library/src/Form/FileUploadForm.php @@ -265,6 +265,7 @@ public function uploadButtonSubmit(array $form, FormStateInterface $form_state) */ protected function createMediaFromValue(MediaTypeInterface $media_type, EntityStorageInterface $media_storage, $source_field_name, $file) { if (!($file instanceof FileInterface)) { + \Drupal::logger('file')->notice('Cannot create a media item without a file entity'); throw new \InvalidArgumentException('Cannot create a media item without a file entity.'); } @@ -272,10 +273,12 @@ protected function createMediaFromValue(MediaTypeInterface $media_type, EntitySt $item = $this->createFileItem($media_type); $upload_location = $item->getUploadLocation(); if (!$this->fileSystem->prepareDirectory($upload_location, FileSystemInterface::CREATE_DIRECTORY)) { + \Drupal::logger('file')->notice("The destination directory '$upload_location' is not writable"); throw new FileWriteException("The destination directory '$upload_location' is not writable"); } $file = file_move($file, $upload_location); if (!$file) { + \Drupal::logger('file')->notice("Unable to move file to '$upload_location'"); throw new \RuntimeException("Unable to move file to '$upload_location'"); } diff --git a/core/modules/media_library/src/MediaLibraryUiBuilder.php b/core/modules/media_library/src/MediaLibraryUiBuilder.php index b5e30c36f3..6ba912b922 100644 --- a/core/modules/media_library/src/MediaLibraryUiBuilder.php +++ b/core/modules/media_library/src/MediaLibraryUiBuilder.php @@ -293,6 +293,7 @@ protected function buildMediaTypeAddForm(MediaLibraryState $state) { $selected_type_id = $state->getSelectedTypeId(); if (!$this->entityTypeManager->getAccessControlHandler('media')->createAccess($selected_type_id)) { + \Drupal::logger('file')->notice("Unable to create access"); return []; } @@ -300,6 +301,7 @@ protected function buildMediaTypeAddForm(MediaLibraryState $state) { $plugin_definition = $selected_type->getSource()->getPluginDefinition(); if (empty($plugin_definition['forms']['media_library_add'])) { + \Drupal::logger('file')->notice('$plugin_definition[\'forms\'][\'media_library_add\'] empty'); return []; } diff --git a/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php b/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php index a1a8a0c56e..c9ff43a6cc 100644 --- a/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php +++ b/core/modules/media_library/tests/src/FunctionalJavascript/UploadFail.php @@ -66,7 +66,7 @@ public function testManyConsecutiveUploads() { $count = 0; // Upload then remove an image 100x to see if/when it fails. while ($count < 100) { - \Drupal::logger('file')->notice("Starting iteration $count"); + \Drupal::logger('file')->notice("\n\nStarting iteration $count"); $this->assertElementExistsAfterWait('css', '.media-library-open-button[name^="field_twin_media"]', 10000, "Twin media open button not found on iteration $count")->click(); $this->assertElementExistsAfterWait('css', '.media-library-menu', 10000, "Media library menu did not appear on iteration $count"); $this->waitForText('Add or select media', 10000, "Text 'Add or select media' not appear on iteration $count");