function FileBase::verifyDirectory in Forena Reports 7.5
Same name and namespace in other branches
- 8 src/File/FileBaseOld.php \Drupal\forena\File\FileBase::verifyDirectory()
1 call to FileBase::verifyDirectory()
- FileBase::save in src/
File/ FileBase.php - Save a file into the report directory.
File
- src/
File/ FileBase.php, line 314 - FileBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
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;
}