function FrxFile::verifyDirectory in Forena Reports 7.4
1 call to FrxFile::verifyDirectory()
- FrxFile::save in ./
FrxFile.inc - Save a file into the report directory.
File
- ./
FrxFile.inc, line 312 - FrxFile.inc File toolbox for manipulating files contained tn the report directory.
Class
- FrxFile
- @file FrxFile.inc File toolbox for manipulating files contained tn the report directory.
Code
function verifyDirectory($fullpath, $recursive = FALSE) {
static $path = '';
$success = TRUE;
if (!$recursive) {
$path = $this->dir;
if (!is_writable($path)) {
drupal_set_message(t('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, '/')) {
$this
->verifyDirectory($file, TRUE);
}
return TRUE;
}