Enable to delete file even if drupal is using it. (NOT IMPLEMENTED YET)

Created on 24 August 2020, about 4 years ago
Updated 5 April 2023, over 1 year ago

Problem/Motivation

As discussed in #3164519: Drupal 8 cannot delete image, it show "XX.JPG is in use by another application" , it is not possible to delete an image if it is being used by drupal. I had a look in the code and I see that
$ignore_usage = $fm->getConf('ignore_usage', FALSE); was already implemented but the feature was not totally ready to be used.

Proposed resolution

Finish the implementation, so site admins and site builders can manage if a user will be able to ignore the file usage when deleting it.

Feature request
Status

Fixed

Version

3.0

Component

Code

Created by

🇧🇷Brazil paulocs Belo Horizonte

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Hm, seems that this got lost in the later releases v2 and v3, so this actually should be re-opened. And re-implemented? Or some documentary or statment here should explain where to find this option or why it has not been implemented (sometimes such things happen for good reasons but should be documented somehwere).

  • 🇫🇷France dqd London | N.Y.C | Paris | Hamburg | Berlin

    Apart from #15, another thing I worry about is:

    +    $conf['operation_settings']['ignore_usage'] = [
    +      '#type' => 'checkbox',
    +      '#title' => $this->t('Ignore the file usage when deleting it.'),
    +      '#default_value' => $imce_profile->getConf('ignore_usage'),
    +      '#description' => $this->t('If it is checked it will be able to delete a file even if it is being used somewhere else. Pay attation if you really wanna to enable it.'),
    +      '#parents' => ['conf', 'ignore_usage'],
    +    ];
    

    Is just an attempt to override the default config which disallows ignoring usage. But: I am not sure if this is enough to solve that underlying problem and it can possibly break the site if the image has other relations on the site which are not known yet. I wonder if this would cause things like, for example, keeping orphaned revision data of this image in the database, which could become a problem later. I wonder if this is enough to just note "pay attention" or if it rather should be seomthing more ringing like: "Be warned! This setting should only be used temporarely for chirurgical purposes, where an image won't allow to be deleted, but you are sure it has definitely no usage or connection no more in the system. Make sure revisions are turned of for this image is it still exist in the content file or media overviews. Standard setting should be OFF (recommended)."

Production build 0.71.5 2024