function forena_delete_report in Forena Reports 7.2
Same name and namespace in other branches
- 8 forena.report.inc \forena_delete_report()
- 6.2 forena.admin.inc \forena_delete_report()
- 6 forena.admin.inc \forena_delete_report()
- 7.5 forena.report.inc \forena_delete_report()
- 7 forena.admin.inc \forena_delete_report()
- 7.3 forena.admin.inc \forena_delete_report()
- 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 - FrxDrupalApplication::not_found in ./
FrxDrupalApplication.inc - What to do if we don't find a report Enter description here ...
File
- ./
forena.admin.inc, line 251
Code
function forena_delete_report($report_name, $delete_file = TRUE) {
$report_path = forena_report_path();
$language = 'en';
$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 (module_exists('locale')) {
@(list($tlang, $tname) = explode('/', $report_name, 2));
if (array_key_exists($tlang, language_list())) {
$report_name = $tname;
$language = $tlang;
}
}
if ($do) {
db_delete('forena_reports')
->condition('report_name', $report_name)
->condition('language', $language)
->execute();
}
else {
drupal_set_message('Unable to delete file ' . $info['basename'], 'error');
}
}