You are here

public function FileSystemBase::save in Forena Reports 8

Save a file into the report directory.

Parameters

string $filename:

string $data:

Return value

void

Overrides FileInterface::save

1 method overrides FileSystemBase::save()
TestingReportFileSystem::save in tests/src/Unit/Mock/TestingReportFileSystem.php
Save a file into the report directory.

File

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

Class

FileSystemBase

Namespace

Drupal\forena\File

Code

public function save($filename, $data) {
  $path = $this->dir . '/' . $filename;
  $this
    ->verifyDirectory($filename);
  if (is_writable($path) || !file_exists($path) && is_writable(dirname($path))) {
    file_put_contents($path, $data);
  }
  else {
    Frx::error(t('Insufficient privileges to write file.'));
  }
}