Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -1663,47 +1663,9 @@ |
1664 | 1664 | * Make directory, and make all parent directories if they don't exist |
1665 | 1665 | */ |
1666 | 1666 | function wfMkdirParents( $fullDir, $mode = 0777 ) { |
1667 | | - if ( strval( $fullDir ) === '' ) { |
| 1667 | + if( strval( $fullDir ) === '' ) |
1668 | 1668 | return true; |
1669 | | - } |
1670 | | - |
1671 | | - # Go back through the paths to find the first directory that exists |
1672 | | - $currentDir = $fullDir; |
1673 | | - $createList = array(); |
1674 | | - while ( strval( $currentDir ) !== '' && !file_exists( $currentDir ) ) { |
1675 | | - # Strip trailing slashes |
1676 | | - $currentDir = rtrim( $currentDir, '/\\' ); |
1677 | | - |
1678 | | - # Add to create list |
1679 | | - $createList[] = $currentDir; |
1680 | | - |
1681 | | - # Find next delimiter searching from the end |
1682 | | - $p = max( strrpos( $currentDir, '/' ), strrpos( $currentDir, '\\' ) ); |
1683 | | - if ( $p === false ) { |
1684 | | - $currentDir = false; |
1685 | | - } else { |
1686 | | - $currentDir = substr( $currentDir, 0, $p ); |
1687 | | - } |
1688 | | - } |
1689 | | - |
1690 | | - if ( count( $createList ) == 0 ) { |
1691 | | - # Directory specified already exists |
1692 | | - return true; |
1693 | | - } elseif ( $currentDir === false ) { |
1694 | | - # Went all the way back to root and it apparently doesn't exist |
1695 | | - return false; |
1696 | | - } |
1697 | | - |
1698 | | - # Now go forward creating directories |
1699 | | - $createList = array_reverse( $createList ); |
1700 | | - foreach ( $createList as $dir ) { |
1701 | | - # use chmod to override the umask, as suggested by the PHP manual |
1702 | | - if ( !mkdir( $dir, $mode ) || !chmod( $dir, $mode ) ) { |
1703 | | - wfDebugLog( 'mkdir', "Unable to create directory $dir\n" ); |
1704 | | - return false; |
1705 | | - } |
1706 | | - } |
1707 | | - return true; |
| 1669 | + return mkdir( $fullDir, $mode, true ); |
1708 | 1670 | } |
1709 | 1671 | |
1710 | 1672 | /** |