Permalink
Browse files

MDL-29773 use db debuginfo when file record insertion fails

  • Loading branch information...
1 parent 263c528 commit cfb15041cfeb050234a774ae6435a5f2e300f308 @skodak skodak committed with stronk7 Oct 14, 2011
Showing with 3 additions and 15 deletions.
  1. +3 −15 lib/filestorage/file_storage.php
@@ -669,12 +669,8 @@ public function create_file_from_storedfile($file_record, $fileorid) {
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 @@ public function create_file_from_pathname($file_record, $pathname) {
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 @@ public function create_file_from_string($file_record, $content) {
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);

0 comments on commit cfb1504

Please sign in to comment.