function _forena_verify_directory in Forena Reports 8
Same name and namespace in other branches
- 6.2 forena.admin.inc \_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
$fullpath Full path to the drectory to be copied:
$recursive Whether we are in a recursive call.:
Return value
bool Indicates whether the directory exists.
1 call to _forena_verify_directory()
- forena_save_report in ./
forena.common.inc - Save the report file to disk
File
- ./
forena.module, line 535
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', FALSE);
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;
}