function session_cache_file_directory in Session Cache API 8
Same name and namespace in other branches
- 7 session_cache_file/session_cache_file.module \session_cache_file_directory()
5 calls to session_cache_file_directory()
- session_cache_file_cron in session_cache_file/
session_cache_file.module - Implements hook_cron().
- session_cache_file_requirements in session_cache_file/
session_cache_file.module - Implements hook_requirements().
- session_cache_file_session_cache_get in session_cache_file/
session_cache_file.module - Implements hook_session_cache_get().
- session_cache_file_session_cache_set in session_cache_file/
session_cache_file.module - Implements hook_session_cache_set().
- session_cache_file_uninstall in session_cache_file/
session_cache_file.install - Implements hook_uninstall().
File
- session_cache_file/
session_cache_file.module, line 24 - session_cache_file.module
Code
function session_cache_file_directory($bin = NULL) {
$path = config('system.file')
->get('path.private');
// typically: sites/default/files/private
if (empty($path)) {
drupal_set_message(t('Session Cache File: the <strong>Private file system path</strong> is not set. Please configure it <a href="@url">here</a>.', array(
'@url' => url('admin/config/media/file-system'),
)), 'warning', FALSE);
return FALSE;
}
$path = DRUPAL_ROOT . "/{$path}/session_cache";
if (!file_exists($path) && !@mkdir($path)) {
drupal_set_message(t('Session cache directory %path could not be created.', array(
'%path' => $path,
)), 'error', FALSE);
return FALSE;
}
if (empty($bin)) {
return $path;
}
if (!file_exists("{$path}/{$bin}") && !@mkdir("{$path}/{$bin}")) {
drupal_set_message(t('Session cache subdirectory %bin could not be created inside %path', array(
'%bin' => $bin,
'%path' => $path,
)), 'error', FALSE);
return FALSE;
}
return "{$path}/{$bin}";
}