You are here

public function FrxFile::revert in Forena Reports 7.4

Revert an individual report

Parameters

$file:

File

./FrxFile.inc, line 229
FrxFile.inc File toolbox for manipulating files contained tn the report directory.

Class

FrxFile
@file FrxFile.inc File toolbox for manipulating files contained tn the report directory.

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