You are here

public function FileBase::revert in Forena Reports 7.5

Same name and namespace in other branches
  1. 8 src/File/FileBaseOld.php \Drupal\forena\File\FileBase::revert()

Revert an individual report

Parameters

$file:

File

src/File/FileBase.php, line 231
FileBase.inc File toolbox for manipulating files contained tn the report directory.

Class

FileBase

Namespace

Drupal\forena\File

Code

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;
}