Problem/Motivation

https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Extension...

file_prepare_directory accepts only two parameters.

This was added in #2099467: Let non-interactive installers determine mode of files directory and its subdirectories but this was removed by #2121849: Move file_chmod_directory and file_chmod_file out of config and into settings so that drush_chmod() is independant of the config system. This got left over.

Proposed resolution

Fix example code to concur with the current state of HEAD.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Comments

Chi created an issue. See original summary.

tameeshb’s picture

Status: Active » Needs review
StatusFileSize
new30.98 KB
tameeshb’s picture

But what is to be done with $mode then? Where will it be used?
$mode = isset($GLOBALS['install_state']['mode']) ? $GLOBALS['install_state']['mode'] : NULL;

Status: Needs review » Needs work

The last submitted patch, 2: 2851468-2.patch, failed testing.

tameeshb’s picture

Sorry wrong patch, i'm redoing it!

tameeshb’s picture

StatusFileSize
new695 bytes
tameeshb’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: 2851468-4.patch, failed testing.

anish.a’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Needs work » Needs review
StatusFileSize
new695 bytes

Bumping the version

Pavan B S’s picture

Assigned: Unassigned » Pavan B S
Status: Needs review » Reviewed & tested by the community

Thanks for the patch , it is working fine

alexpott’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
+++ b/core/lib/Drupal/Core/Extension/module.api.php
@@ -231,7 +231,7 @@ function hook_install() {
   $mode = isset($GLOBALS['install_state']['mode']) ? $GLOBALS['install_state']['mode'] : NULL;

This now looks weird. In fact this was removed in #2121849: Move file_chmod_directory and file_chmod_file out of config and into settings so that drush_chmod() is independant of the config system and should be cleaned-up here.

alexpott’s picture

When fixing thing like this is it really important to try and work out why things like this occur. Using git log -S is a great way to. It allows to find when lines of code are added and removed. So doing git log -S "file_prepare_directory(\$directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS, \$mode);" finds commits related to this issue.

ashishdalvi’s picture

We will work on it in Drupal Mumbai Code sprint #16

dhirendra.mishra’s picture

I am working on it

dhirendra.mishra’s picture

Status: Needs work » Needs review
StatusFileSize
new734 bytes

Adding a patch.Kindly review it.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

joelpittet’s picture

Assigned: dhirendra.mishra » Unassigned
Status: Needs review » Reviewed & tested by the community

There is no $mode param so yeah this looks good.

  • Gábor Hojtsy committed 0bbac0e on 8.5.x
    Issue #2851468 by tameeshb, dhirendra.mishra, alexpott, joelpittet:...

  • Gábor Hojtsy committed e51c522 on 8.4.x
    Issue #2851468 by tameeshb, dhirendra.mishra, alexpott, joelpittet:...
gábor hojtsy’s picture

Version: 8.5.x-dev » 8.4.x-dev
Status: Reviewed & tested by the community » Fixed

Thanks all, committed!

Status: Fixed » Closed (fixed)

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