Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
745b7bed
Commit
745b7bed
authored
Nov 04, 2005
by
Dries Buytaert
Browse files
- Patch
#10658
by Morbus: create new folders with the right permissions.
parent
22fbada4
Changes
1
Hide whitespace changes
Inline
Side-by-side
includes/file.inc
View file @
745b7bed
...
...
@@ -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
,
07
60
))
{
if
((
$mode
&
FILE_MODIFY_PERMISSIONS
)
&&
@
chmod
(
$directory
,
07
75
))
{
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
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment