You are here

function forena_delete_report in Forena Reports 7

Same name and namespace in other branches
  1. 8 forena.report.inc \forena_delete_report()
  2. 6.2 forena.admin.inc \forena_delete_report()
  3. 6 forena.admin.inc \forena_delete_report()
  4. 7.5 forena.report.inc \forena_delete_report()
  5. 7.2 forena.admin.inc \forena_delete_report()
  6. 7.3 forena.admin.inc \forena_delete_report()
  7. 7.4 forena.report.inc \forena_delete_report()

Remove the report from the database and file system.

Parameters

string $report_name:

2 calls to forena_delete_report()
forena_delete_form_submit in ./forena.admin.inc
forena_report in ./forena.module
Load and render a report based on a drupal path. In this function the arglist is used to get the full path to the report.

File

./forena.admin.inc, line 180

Code

function forena_delete_report($report_name, $delete_file = TRUE) {
  $report_path = forena_report_path();
  $filepath = $report_path . '/' . $report_name . '.frx';
  $info = pathinfo($filepath);
  $do = TRUE;
  if (file_exists($filepath)) {
    chdir($info['dirname']);
    if ($delete_file) {
      $do = unlink($info['basename']);
    }
  }
  if ($do) {
    DB_QUERY("DELETE FROM {forena_reports} WHERE report_name='%s'", array(
      $report_name,
    ));
  }
  else {
    drupal_set_message('Unable to delete file ' . $info['basename'], 'error');
  }
}