Skip to content
Snippets Groups Projects
Commit 745b7bed authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Patch #10658 by Morbus: create new folders with the right permissions.

parent 22fbada4
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -69,7 +69,8 @@ function file_create_path($dest = 0) {
}
/**
* Check that directory exists and is writable.
* Check that the directory exists and is writable. Directories need to
* have execute permissions to be considered a directory by FTP servers, etc.
*
* @param $directory Path to extract and verify directory for.
* @param $mode Try to create the directory if it does not exist.
......@@ -81,8 +82,9 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
// Check if directory exists.
if (!is_dir($directory)) {
if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory, 0760)) {
if (($mode & FILE_CREATE_DIRECTORY) && @mkdir($directory)) {
drupal_set_message(t('The directory %directory has been created.', array('%directory' => theme('placeholder', $directory))));
@chmod($directory, 0775); // Necessary for non-webserver users.
}
else {
if ($form_item) {
......@@ -94,7 +96,7 @@ function file_check_directory(&$directory, $mode = 0, $form_item = NULL) {
// Check to see if the directory is writable.
if (!is_writable($directory)) {
if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0760)) {
if (($mode & FILE_MODIFY_PERMISSIONS) && @chmod($directory, 0775)) {
drupal_set_message(t('The permissions of directory %directory have been changed to make it writable.', array('%directory' => theme('placeholder', $directory))));
}
else {
......@@ -270,6 +272,10 @@ function file_copy(&$source, $dest = 0, $replace = FILE_EXISTS_RENAME) {
drupal_set_message(t('The selected file %file could not be copied.', array('%file' => theme('placeholder', $source))), 'error');
return 0;
}
// Give everyone read access so that FTP'd users or
// non-webserver users can see/read these files.
@chmod($dest, 0664);
}
if (is_object($file)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment