You are here

public function FileSystemBase::revert in Forena Reports 8

Revert an individual report

Parameters

$file:

Return value

int Number of files reverted.

File

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

Class

FileSystemBase

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