We use the Media module in our installation and on some occasions following error is thrown during installation of the profile (and the module obviously):

WD media: Exception: Unable to create directory public://media-icons/default. in _media_install_copy_icons() (line 34 of         [error]
/var/www/profiles/site_installer/modules/contrib/media/media.install).

This happens even if the files folder is removed and prepared with correct permissions beforehand.

Comments

david.lukac created an issue. See original summary.

david.lukac’s picture

StatusFileSize
new1.01 KB

Adding flag FILE_MODIFY_PERMISSIONS to file_prepare_directory() fixes the issue for me - supplying a patch.

david.lukac’s picture

Status: Active » Needs review

Anyone to review the patch? :-)

sylus’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me and is always used through Drupal Core, minor nit being the order written.

image.module

file_prepare_directory($dir_uri, FILE_CREATE_DIRECTORY || FILE_MODIFY_PERMISSIONS);

But looks good to me! Thx so much!

sylus’s picture

Status: Reviewed & tested by the community » Fixed
sylus’s picture

Status: Fixed » Reviewed & tested by the community

Whoops wrong issue, apologies!

betz’s picture

StatusFileSize
new686 bytes

patch recreated with correct operator.

betz’s picture

Status: Reviewed & tested by the community » Needs review

  • joseph.olstad committed 4e38e46 on 7.x-2.x authored by betz
    Issue #2568123 by david.lukac, betz: "Unable to create directory" when...
joseph.olstad’s picture

Version: 7.x-2.0-alpha4 » 7.x-2.x-dev
Status: Needs review » Fixed

fixed in 7.x-2.x dev branch

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mskicker’s picture

unable_to_create-2568123-7.patch NOT WORK for me
php 7.2
But
unable_to_create-2568123-2.patch was OK

joseph.olstad’s picture

weird, patch 2 doesn't have the correct OR operator.

Neither of these patches apply cleanly to the latest build. What release version are you using?