Preserve suid and sgid bits when creating new directories. fixes #2190
git-svn-id: http://svn.automattic.com/wordpress/trunk@3388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
da72493884
commit
807f5ded08
|
@ -205,7 +205,9 @@ class WP_Object_Cache {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists($this->cache_dir.$make_dir."index.php")) {
|
if (!file_exists($this->cache_dir.$make_dir."index.php")) {
|
||||||
|
$file_perms = $perms & 0000666;
|
||||||
@ touch($this->cache_dir.$make_dir."index.php");
|
@ touch($this->cache_dir.$make_dir."index.php");
|
||||||
|
@ chmod($this->cache_dir.$make_dir."index.php", $file_perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,7 +270,8 @@ class WP_Object_Cache {
|
||||||
|
|
||||||
// Give the new dirs the same perms as wp-content.
|
// Give the new dirs the same perms as wp-content.
|
||||||
$stat = stat(ABSPATH.'wp-content');
|
$stat = stat(ABSPATH.'wp-content');
|
||||||
$dir_perms = $stat['mode'] & 0000777; // Get the permission bits.
|
$dir_perms = $stat['mode'] & 0007777; // Get the permission bits.
|
||||||
|
$file_perms = $dir_perms & 0000666; // Remove execute bits for files.
|
||||||
|
|
||||||
// Make the base cache dir.
|
// Make the base cache dir.
|
||||||
if (!file_exists($this->cache_dir)) {
|
if (!file_exists($this->cache_dir)) {
|
||||||
|
@ -279,6 +282,7 @@ class WP_Object_Cache {
|
||||||
|
|
||||||
if (!file_exists($this->cache_dir."index.php")) {
|
if (!file_exists($this->cache_dir."index.php")) {
|
||||||
@ touch($this->cache_dir."index.php");
|
@ touch($this->cache_dir."index.php");
|
||||||
|
@ chmod($this->cache_dir."index.php", $file_perms);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Acquire a write lock.
|
// Acquire a write lock.
|
||||||
|
@ -314,6 +318,7 @@ class WP_Object_Cache {
|
||||||
@ unlink($temp_file);
|
@ unlink($temp_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ chmod($cache_file, $file_perms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -862,7 +862,7 @@ function wp_upload_dir() {
|
||||||
|
|
||||||
// Give the new dirs the same perms as wp-content.
|
// Give the new dirs the same perms as wp-content.
|
||||||
$stat = stat(ABSPATH . 'wp-content');
|
$stat = stat(ABSPATH . 'wp-content');
|
||||||
$dir_perms = $stat['mode'] & 0000777; // Get the permission bits.
|
$dir_perms = $stat['mode'] & 0007777; // Get the permission bits.
|
||||||
|
|
||||||
// Make sure we have an uploads dir
|
// Make sure we have an uploads dir
|
||||||
if ( ! file_exists( $path ) ) {
|
if ( ! file_exists( $path ) ) {
|
||||||
|
@ -929,7 +929,8 @@ function wp_upload_bits($name, $type, $bits) {
|
||||||
fclose($ifp);
|
fclose($ifp);
|
||||||
// Set correct file permissions
|
// Set correct file permissions
|
||||||
$stat = @ stat(dirname($new_file));
|
$stat = @ stat(dirname($new_file));
|
||||||
$perms = $stat['mode'] & 0000777;
|
$perms = $stat['mode'] & 0007777;
|
||||||
|
$perms = $perms & 0000666;
|
||||||
@ chmod($new_file, $perms);
|
@ chmod($new_file, $perms);
|
||||||
|
|
||||||
// Compute the URL
|
// Compute the URL
|
||||||
|
|
Loading…
Reference in New Issue