Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By gnuget on
Change record status:
Draft (View all draft change records)
Project:
Introduced in branch:
8.2.x
Introduced in version:
8.2.0
Issue links:
Description:
file_unmanaged_copy()
and file_unmanage_move()
will create folders if they do not exist.
file_unmanaged_copy
$uri = 'public://myfile.txt';
$file = file_unmanaged_copy($uri, 'public://sub-folder/myfile.txt');
Before $file
would be false if the sub-folder did not exist and the file wouldn't be copied. But now it returns the new $uri and the file is successfully copied and sub-folder directory is created.
file_unmanage_move
$uri = 'public://myfile.txt';
$file = file_unmanage_move($uri, 'public://sub-folder/myfile.txt');
Before $file
would be false if sub-folder did not and the file wouldn't be copied. But now it returns the new $uri and the file is successfully copied and sub-folder directory is created.
Impacts:
Module developers