You are here

function ContentExport::delete in Content Export YAML 8

delete file in folder

Parameters

$file String: path of file for eg : /sites/default/files/export/node/10.yml

1 call to ContentExport::delete()
ContentExport::download_yml in src/ContentExport.php
download_yml

File

src/ContentExport.php, line 413

Class

ContentExport
Created by PhpStorm. User: USER Date: 11/13/18 Time: 2:04 PM

Namespace

Drupal\content_export_yaml

Code

function delete($file) {
  $file = DRUPAL_ROOT . $file;
  if (file_exists($file)) {
    if (is_writable($file) && @unlink($file)) {
      return TRUE;
    }
    else {
      $this->logger
        ->error('File  not write : ' . $file);
      \Drupal::messenger()
        ->addMessage(t('File  not write : ' . $file), 'error');
      return FALSE;
    }
  }
  return FALSE;
}