You are here

function omega_tools_rewrite_recursive in Omega Tools 7.3

@todo

1 call to omega_tools_rewrite_recursive()
omega_tools_subtheme_create in ./omega_tools.module
@todo

File

./omega_tools.module, line 304

Code

function omega_tools_rewrite_recursive($path, $search, $replace, $rename) {
  if ($path !== ($new = str_replace($search, $rename, $path))) {
    if (!($path = file_unmanaged_move($path, $new, FILE_EXISTS_REPLACE))) {
      return FALSE;
    }
  }
  if (is_dir($path)) {
    $directory = dir($path);
    while (FALSE !== ($read = $directory
      ->read())) {
      if ($read != '.' && $read != '..') {
        if (!omega_tools_rewrite_recursive($path . '/' . $read, $search, $replace, $rename)) {
          return FALSE;
        }
      }
    }
    $directory
      ->close();
  }
  else {
    omega_tools_replace_contents($path, $search, $replace);
  }
  return TRUE;
}