You are here

public function FileSystemBase::delete in Forena Reports 8

Delete a file from the directory.

Parameters

string $filename:

Return value

bool

Overrides FileInterface::delete

1 method overrides FileSystemBase::delete()
TestingReportFileSystem::delete in tests/src/Unit/Mock/TestingReportFileSystem.php
Delete a file from the directory.

File

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

Class

FileSystemBase

Namespace

Drupal\forena\File

Code

public function delete($filename) {
  $path = $this->dir . '/' . $filename;
  $dir = getcwd();
  $do = TRUE;
  if (file_exists($path) && is_writeable($path) && is_writable(dirname($path))) {
    $info = pathinfo($path);
    chdir(dirname($path));
    $do = unlink($info['basename']);
    chdir($dir);
  }
  return $do;
}