Call to deprecated function file_prepare_directory()

Created on 25 January 2022, over 2 years ago
Updated 9 October 2023, 9 months ago

Problem/Motivation

In Drupal 9, attempting to save the settings form located at /admin/commerce/pos/settings results in a fatal error:
Error: Call to undefined function Drupal\commerce_pos\Form\file_prepare_directory() in Drupal\commerce_pos\Form\CommercePOSSettingsForm->submitForm()

Steps to reproduce

  1. Install Commerce POS in Drupal 9
  2. Navigate to POS settings page at /admin/commerce/pos/settings
  3. Make a change and attempt to save the page

You should see a fatal error.

Proposed resolution

As per https://www.palantir.net/rector/updating-deprecated-filepreparedirectory..., references to the deprecated file_prepare_directory() function should be replaced with \Drupal::service('file_system')->prepareDirectory($directory, $options);.

Remaining tasks

Test patch (coming in next comment)

User interface changes

None

API changes

None

Data model changes

None

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States amklose Wisconsin

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.

Production build 0.69.0 2024