You are here

function _boost_mkdir_p in Boost 6

Same name and namespace in other branches
  1. 5 boost.helpers.inc \_boost_mkdir_p()

Recursive version of mkdir(), compatible with PHP4.

Parameters

$pathname: The top-level directory that will be recursively created.

$recursive: Operate in a recursive manner.

$depth: How deep the recursion is.

7 calls to _boost_mkdir_p()
boost_admin_boost_performance_page_validate in ./boost.admin.inc
validate boost_admin_boost_performance_page form submissions.
boost_cache_delete in ./boost.module
Deletes files in the cache.
boost_cache_write in ./boost.module
Writes data to filename in an atomic operation thats compatible with older versions of php (php < 5.2.4 file_put_contents() doesn't lock correctly).
boost_htaccess_cache_dir_put in ./boost.module
boost_requirements in ./boost.install
Implementation of hook_requirements().

... See full list

File

./boost.module, line 5284
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function _boost_mkdir_p($pathname, $recursive = TRUE, $depth = 0) {
  $depth++;
  $mode = is_numeric(BOOST_PERMISSIONS_DIR) ? octdec(BOOST_PERMISSIONS_DIR) : 0775;
  if (is_dir($pathname)) {
    return TRUE;
  }
  if ($depth > BOOST_MAX_PATH_DEPTH) {
    return FALSE;
  }
  if ($recursive && !_boost_mkdir_p(dirname($pathname), TRUE, $depth)) {
    return FALSE;
  }
  if ($result = @mkdir($pathname, $mode)) {
    @chmod($pathname, $mode);
  }
  return $result;
}