function FileSystemBase::verifyDirectory in Forena Reports 8
1 call to FileSystemBase::verifyDirectory()
- FileSystemBase::save in src/
File/ FileSystemBase.php - Save a file into the report directory.
File
- src/
File/ FileSystemBase.php, line 285 - FileSystemBase.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;
}