]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Be harsher on database saving failure for File entry
authorMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Sep 2015 09:54:52 +0000 (11:54 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Sun, 27 Sep 2015 09:54:52 +0000 (11:54 +0200)
classes/File.php

index 1a29ea5107e537dec350188c4b7b323e523b2e76..8991616f82e54d825f68c981c0d1ab3071c84743 100644 (file)
@@ -99,6 +99,10 @@ class File extends Managed_DataObject
             if (!empty($redir_data['size'])) $file->size = intval($redir_data['size']);
             if (isset($redir_data['time']) && $redir_data['time'] > 0) $file->date = intval($redir_data['time']);
             $file_id = $file->insert();
+
+            if ($file_id === false) {
+                throw new ServerException('File/URL metadata could not be saved to the database.');
+            }
         }
 
         Event::handle('EndFileSaveNew', array($file, $redir_data, $given_url));