Skip to content

Instantly share code, notes, and snippets.

@ahalbert
Created May 19, 2015 22:11
Show Gist options
  • Select an option

  • Save ahalbert/a53b9d02cc5f57403d49 to your computer and use it in GitHub Desktop.

Select an option

Save ahalbert/a53b9d02cc5f57403d49 to your computer and use it in GitHub Desktop.
function safeCreateDir($dir, $exit = true) {
if (!file_exists($dir)) {
if (!mkdir($dir, 0700, true)) {
$processUser = posix_getpwuid(posix_geteuid());
error_log($dir." ".implode($processUser));
if ($exit) {
debugMail('failed to create dir: ' . $dir, true);
}
return false;
}
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment