function hackedProjectWebDownloader::get_temp_directory in Hacked! 6.2
Same name and namespace in other branches
- 7.2 includes/hackedProjectWebDownloader.inc \hackedProjectWebDownloader::get_temp_directory()
Returns a temp directory to work in.
Parameters
$namespace: The optional namespace of the temp directory, defaults to the classname.
2 calls to hackedProjectWebDownloader::get_temp_directory()
- hackedProjectWebCVSDownloader::get_destination in includes/
hacked_project.inc - Returns a directory to save the downloaded project into.
- hackedProjectWebDownloader::get_destination in includes/
hacked_project.inc - Returns a directory to save the downloaded project into.
File
- includes/
hacked_project.inc, line 343
Class
- hackedProjectWebDownloader
- Base class for downloading remote versions of projects.
Code
function get_temp_directory($namespace = NULL) {
if (is_null($namespace)) {
$namespace = get_class($this);
}
$segments = array(
file_directory_temp(),
'hacked-cache-' . get_current_user(),
$namespace,
);
$dir = implode('/', array_filter($segments));
if (!file_check_directory($dir, FILE_CREATE_DIRECTORY) && !mkdir($dir, 0775, TRUE)) {
watchdog('hacked', 'Failed to create temp directory: %dir', array(
'%dir' => $dir,
), WATCHDOG_ERROR);
return FALSE;
}
return $dir;
}