Documentation is available at mkdirr.function.php
- <?php
- /**
- * @package harmoni.utilities
- */
- /**
- * Create a directory structure recursively
- *
- * @author Aidan Lister <aidan@php.net>
- * @version 1.0.0
- * @param string $pathname The directory structure to create
- * @return bool Returns TRUE on success, FALSE on failure
- */
- function mkdirr($pathname, $mode = null)
- {
- // Check if directory already exists
- if (is_dir($pathname) || empty($pathname)) {
- return true;
- }
- // Ensure a file does not already exist with the same name
- if (is_file($pathname)) {
- trigger_error('mkdirr() File exists', E_USER_WARNING);
- return false;
- }
- // Crawl up the directory tree
- $next_pathname = substr($pathname, 0, strrpos($pathname, DIRECTORY_SEPARATOR));
- if (mkdirr($next_pathname, $mode)) {
- if (!file_exists($pathname)) {
- //changed the following 4 lines to allow custom permissions
- $old = umask(0);
- $returnValue = mkdir($pathname, $mode);
- umask($old);
- return $returnValue;
- }
- }
- return false;
- }
- ?>
Documentation generated on Wed, 19 Sep 2007 10:25:06 -0400 by phpDocumentor 1.3.0RC3