From cfb15041cfeb050234a774ae6435a5f2e300f308 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Fri, 14 Oct 2011 15:30:54 +0200 Subject: [PATCH] MDL-29773 use db debuginfo when file record insertion fails --- lib/filestorage/file_storage.php | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/lib/filestorage/file_storage.php b/lib/filestorage/file_storage.php index 4c97d64f2f2..e62def54244 100644 --- a/lib/filestorage/file_storage.php +++ b/lib/filestorage/file_storage.php @@ -669,12 +669,8 @@ class file_storage { try { $newrecord->id = $DB->insert_record('files', $newrecord); } catch (dml_exception $e) { - $newrecord->id = false; - } - - if (!$newrecord->id) { throw new stored_file_creation_exception($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, - $newrecord->filepath, $newrecord->filename); + $newrecord->filepath, $newrecord->filename, $e->debuginfo); } $this->create_directory($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, $newrecord->filepath, $newrecord->userid); @@ -814,15 +810,11 @@ class file_storage { try { $newrecord->id = $DB->insert_record('files', $newrecord); } catch (dml_exception $e) { - $newrecord->id = false; - } - - if (!$newrecord->id) { if ($newfile) { $this->deleted_file_cleanup($newrecord->contenthash); } throw new stored_file_creation_exception($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, - $newrecord->filepath, $newrecord->filename); + $newrecord->filepath, $newrecord->filename, $e->debuginfo); } $this->create_directory($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, $newrecord->filepath, $newrecord->userid); @@ -907,15 +899,11 @@ class file_storage { try { $newrecord->id = $DB->insert_record('files', $newrecord); } catch (dml_exception $e) { - $newrecord->id = false; - } - - if (!$newrecord->id) { if ($newfile) { $this->deleted_file_cleanup($newrecord->contenthash); } throw new stored_file_creation_exception($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, - $newrecord->filepath, $newrecord->filename); + $newrecord->filepath, $newrecord->filename, $e->debuginfo); } $this->create_directory($newrecord->contextid, $newrecord->component, $newrecord->filearea, $newrecord->itemid, $newrecord->filepath, $newrecord->userid);