You are here

function _hacked_get_temp_dir in Hacked! 7.3

Create and get temp directory.

3 calls to _hacked_get_temp_dir()
_hacked_download_archive in ./hacked.helpers.inc
Download archive.
_hacked_extract_archive in ./hacked.helpers.inc
Extract archive.
_hacked_restore_project in ./hacked.helpers.inc
Restore core, module or theme.

File

./hacked.helpers.inc, line 16
Contain list of helpers for the module.

Code

function _hacked_get_temp_dir($subdir = '') {
  $hash = substr(drupal_hash_base64(variable_get('site_name')), 0, 8);
  $dirname = file_directory_temp() . '/hacked-' . $hash . '/' . $subdir;
  if (!file_prepare_directory($dirname, FILE_CREATE_DIRECTORY) && !mkdir($dirname, 0777, TRUE)) {
    watchdog('hacked', 'Failed to create temp directory: %dirname', [
      '%dirname' => $dirname,
    ], WATCHDOG_ERROR);
    return FALSE;
  }
  return $dirname;
}