public function FileBase::revert in Forena Reports 8
Same name and namespace in other branches
- 7.5 src/File/FileBase.php \Drupal\forena\File\FileBase::revert()
Revert an individual report
Parameters
$file:
Return value
int Returns the number or reports reverted.
File
- src/
File/ FileBaseOld.php, line 226 - FileSystemBase.inc File toolbox for manipulating files contained tn the report directory.
Class
Namespace
Drupal\forena\FileCode
public function revert($file) {
$i = 0;
if ($this
->includeExists($file)) {
$file_to_delete = $this->dir . '/' . $file;
if (file_exists($file_to_delete)) {
if (is_writeable(dirname($file_to_delete))) {
drupal_set_message(t('Removing customization %s', array(
'%s' => $file_to_delete,
)));
unlink($file_to_delete);
$i++;
}
else {
drupal_set_message(t('Unable to revert %s', array(
'%s' => $file_to_delete,
)), 'error');
}
}
}
return $i;
}