diff --git a/core/modules/file/file.install b/core/modules/file/file.install
index 8c4c339..2d00681 100644
--- a/core/modules/file/file.install
+++ b/core/modules/file/file.install
@@ -5,6 +5,8 @@
* Install, update and uninstall functions for File module.
*/
+use Drupal\Core\Url;
+
/**
* Implements hook_schema().
*/
@@ -116,6 +118,12 @@ function file_requirements($phase) {
'value' => $value,
'description' => $description,
);
+ $file_config = \Drupal::configFactory()->get('file.settings');
+ $requirements['file_orphaned_file_delete'] = array(
+ 'title' => t('Orphaned file delete'),
+ 'value' => t('There are currently known bugs with file usage counting. It is recommended to leave \'Mark unused files as orphaned\' disabled to prevent the loss of files.', array(':url' => Url::fromRoute('system.file_system_settings', [], ['fragment' => 'edit-orphaned-files'])->toString())),
+ 'severity' => $file_config->get('make_unused_managed_files_temporary') ? REQUIREMENT_WARNING : REQUIREMENT_OK,
+ );
}
return $requirements;
diff --git a/core/modules/file/file.module b/core/modules/file/file.module
index 70a0bce..7787aaf 100644
--- a/core/modules/file/file.module
+++ b/core/modules/file/file.module
@@ -1566,13 +1566,25 @@ function _views_file_status($choice = NULL) {
*/
function file_form_system_file_system_settings_alter(&$form, FormStateInterface $form_state) {
$config = \Drupal::configFactory()->getEditable('file.settings');
- $form['make_unused_managed_files_temporary'] = [
+ $form['orphaned_files'] = [
+ '#type' => 'details',
+ '#title' => t('Orphaned files'),
+ '#open' => TRUE
+ ];
+
+ $form['orphaned_files']['make_unused_managed_files_temporary'] = [
'#type' => 'checkbox',
- '#title' => t('Mark unused files as temporary'),
+ '#title' => t('Mark unused files as orphaned'),
'#default_value' => $config->get('make_unused_managed_files_temporary'),
- '#description' => t('If checked, files for which all usages are removed are marked as temporary and then later on removed. Warning: There are currently known bugs with file usage counting, it is recommended to leave this disabled to prevent the loss of files.'),
+ '#description' => t('Warning: There are currently known bugs with file usage counting. It is recommended to leave disabled to prevent the loss of files.'),
];
+ // Move the temporary_maximum_age settings and make it optionally visible
+ // depending on the state of the new element.
+ $temporary_maximum_age_element = $form['temporary_maximum_age'];
+ unset($form['temporary_maximum_age']);
+ $form['orphaned_files']['temporary_maximum_age'] = $temporary_maximum_age_element;
+
$form['#submit'][] = 'file_system_file_settings_submit';
}