Ticket #25822: 25822.diff
File 25822.diff, 983 bytes (added by , 11 years ago) |
---|
-
src/wp-includes/functions.php
1368 1368 } 1369 1369 1370 1370 // Get the permission bits. 1371 if ( $target_parent && '.' != $target_parent ) {1372 $stat = @stat( $target_parent );1371 $dir_perms = false; 1372 if ( $stat = @stat( $target_parent ) ) { 1373 1373 $dir_perms = $stat['mode'] & 0007777; 1374 1374 } else { 1375 1375 $dir_perms = 0777; 1376 1376 } 1377 1377 1378 1378 if ( @mkdir( $target, $dir_perms, true ) ) { 1379 1380 // If a umask is set that modifies $dir_perms, we'll have to re-set the $dir_perms correctly with chmod() 1381 if ( $dir_perms != $dir_perms & ~umask() ) { 1382 $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) ); 1383 for ( $i = 1; $i <= count( $folder_parts ); $i++ ) { 1384 @chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms ); 1385 } 1386 } 1387 1379 1388 return true; 1380 1389 } 1381 1390