Better handling of special cases when private files directory cannot be written to

Created on 11 November 2024, 4 days ago

Problem/Motivation

If the private files directory cannot be written to, e.g. because it does not exist, then warning is logged on form submission:

Warning: file_put_contents(private://webform_handler_defer_log.json): Failed to open stream: "Drupal\Core\StreamWrapper\PrivateStream::stream_open" call failed in Drupal\webform_handler_defer\Plugin\WebformHandler\WebformHandlerDefer::submissionList() (line 191 of /app/web/modules/dev/webform_handler_defer/src/Plugin/WebformHandler/WebformHandlerDefer.php)

That's reasonable - this is a site misconfiguration. But the module doesn't detect that the submission id was not recorded, meaning that deferred handlers will never be run.

Steps to reproduce

1. Delete or rename the private files directory - by default sites/default/files/private).
2. Submit a webform which has deferred submissions configured.

Proposed resolution

Handle this and similar conditions by logging a message and falling back to standard submission process, similar to the way that failure to acquire a lock is handled.

Remaining tasks

Code changes and retest.

Feature request
Status

Active

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom andy inman Gloucestershire, UK

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

Comments & Activities

Production build 0.71.5 2024