Webform delete and removal of files

Created on 12 May 2023, over 1 year ago
Updated 21 June 2023, over 1 year ago

Problem/Motivation

Error at drush config import if there was problem with file checking at webform delete.

Steps to reproduce

  1. You need a file storage system that requires logged in Drupal user in order to authenticate to it.
  2. There is a webform "A" existing that is already exported in config.
  3. As system admin, duplicate the webform "A", then you have another webform "B"
  4. Using drush, import configs. This results into delete of the webform "B"
  5. Now in the webform/src/WebformEntityStorage.php delete function fails with error as the authentication to file storage system fails.

Proposed resolution

Couple of possible approaches:

  • Wrap the file deletion part to try catch and log error. The webform and submissions are deleted at this point anyways?
  • or detect if any field that could upload a file was used AND there was submissions.

Remaining tasks

Come up preferred approach.

User interface changes

None.

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Closed: cannot reproduce

Version

6.2

Component

Code

Created by

🇫🇮Finland MikaT

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

Comments & Activities

  • Issue created by @MikaT
  • I moved this to the feature branch.

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MySQL 8
    last update over 1 year ago
    Patch Failed to Apply
  • 🇧🇬Bulgaria mitaka Sofia

    Config import command output:

    // Import the listed configuration changes?: yes.                              
    
     [error]  Access denied to file at uri location://webform/webform_name
     [warning] Unable to remove webform files from location://webform/webform_name. Message 
     [notice] Synchronized configuration: delete webform.webform.webform_name.
     [notice] Finalizing configuration synchronization.
     [success] The configuration was imported successfully.
    
  • 🇺🇸United States jrockowitz Brooklyn, NY

    The private:// file system requires authentication, so we can use it for testing.

    All submissions have to be deleted before a webform is deleted via config-import. See the below steps.

    I am unsure what triggers the error for your authenticated file system. It is very possible that this error is specific to your file system.

    One guess is via Drush, you will need to use an authenticated user during the config import. This does not seem to be supported.
    @see 📌 Run drush imports as user=1 RTBC

    Steps attempting to replicate

    • Import or create the attached webform. /admin/config/development/configuration/single/import
    • Add test results to the new webform. /webform/issue_3359937/test
    • Export config. `drush config-export`
    • Duplicate the webform. /admin/structure/webform/manage/issue_3359937/duplicate
    • Add test results to the duplicate webform. /webform/issue_3359937_duplicate/test
    • Import config and config delete duplicate webform. `drush config-import`
    • Confirm that 'These entities need to be deleted before importing.' is displayed.
    • Delete all duplicate submissions. /admin/structure/webform/manage/issue_3359937_duplicate/results/clear
    • Import config and config delete duplicate webform. `drush config-import`
    • Confirm that the duplicate webform is deleted.
  • Status changed to Postponed: needs info over 1 year ago
  • 🇺🇸United States jrockowitz Brooklyn, NY
  • Status changed to Closed: cannot reproduce over 1 year ago
  • 🇺🇸United States jrockowitz Brooklyn, NY
Production build 0.71.5 2024