function _forena_verify_directory in Forena Reports 6.2
Same name and namespace in other branches
- 8 forena.module \_forena_verify_directory()
- 6 forena.admin.inc \_forena_verify_directory()
- 7.5 forena.module \_forena_verify_directory()
- 7 forena.admin.inc \_forena_verify_directory()
- 7.2 forena.admin.inc \_forena_verify_directory()
- 7.3 forena.module \_forena_verify_directory()
- 7.4 forena.module \_forena_verify_directory()
Make sure a drectory exists in the report path prior to save.
Parameters
unknown_type $fullpath:
unknown_type $recursive:
1 call to _forena_verify_directory()
- forena_save_report in ./
forena.admin.inc - Save the report file to disk
File
- ./
forena.admin.inc, line 38
Code
function _forena_verify_directory($fullpath, $recursive = FALSE) {
static $path = '';
$success = TRUE;
if (!$recursive) {
$path = forena_report_path();
if (!is_writable($path)) {
drupal_set_message(t('Report directory %s is not modifiable', array(
'%s' => $path,
)), 'error');
return FALSE;
}
}
@(list($dir, $file) = explode('/', $fullpath, 2));
$path .= '/' . $dir;
// Path
if (!file_exists($path) && $file) {
@mkdir($path);
if (!@is_writable($path)) {
drupal_set_message(t('Error creating directory %path', array(
'%path' => $path,
)), 'error');
return FALSE;
}
}
// Recurse to next file.
if ($file && strpos($file, '/')) {
_forena_verify_directory($file, TRUE);
}
return TRUE;
}