Log/file.php
function _mkpath($path, $mode = 0700)
    {
        /* Separate the last pathname component from the rest of the path. */
        $head = dirname($path);
        $tail = basename($path);

        /* Make sure we've split the path into two complete components. */
        if (empty($tail)) {
            $head = dirname($path);
            $tail = basename($path);
        }

        /* Recurse up the path if our current segment does not exist. */
        if (!empty($head) && !empty($tail) && !is_dir($head)) {
            $this->_mkpath($head, $mode);
        }

        /* Create this segment of the path. */
        return @mkdir($head, $mode);
    }
function _mkpath($path, $mode = 0700)
    {
        /* Separate the last pathname component from the rest of the path. */
        $head = dirname($path);
        $tail = basename($path);

        /* Make sure we've split the path into two complete components. */
        if (empty($tail)) {
            $head = dirname($path);
            $tail = basename($path);
        }

        /* Recurse up the path if our current segment does not exist. */
        if (!empty($head) && !empty($tail) && !is_dir($head)) {
            $this->_mkpath($head, $mode);
        }

        /* Create this segment of the path. */
        return @mkdir($head, $mode);
    }
function _mkpath ( $ path , $ mode = 0700 ) { /* Separate the last pathname component from the rest of the path. */ $ head = dirname ( $ path ) ; $ tail = basename ( $ path ) ; /* Make sure we've split the path into two complete components. */ if ( empty ( $ tail ) ) { $ head = dirname ( $ path ) ; $ tail = basename ( $ path ) ; } /* Recurse up the path if our current segment does not exist. */ if ( ! empty ( $ head ) && ! empty ( $ tail ) && ! is_dir ( $ head ) ) { $ this -> _mkpath ( $ head , $ mode ) ; } /* Create this segment of the path. */ return @ mkdir ( $ head , $ mode ) ; }
Creates the given directory path.  If the parent directories don't
already exist, they will be created, too.

This implementation is inspired by Python's os.makedirs function.

@param   string  $path       The full directory path to create.
@param   integer $mode       The permissions mode with which the
directories will be created.

@return  True if the full path is successfully created or already
exists.

@access  private
Creates the given directory path . If the parent directories don t already exist they will be created too .