changeset 833:f03c4e9aad29

Improve error logging.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Nov 2014 14:56:06 +0200
parents bd1cfc7b52d2
children 6b962658351c
files msite.inc.php
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/msite.inc.php	Tue Nov 25 14:11:20 2014 +0200
+++ b/msite.inc.php	Tue Nov 25 14:56:06 2014 +0200
@@ -1002,7 +1002,7 @@
   // Get file magic info
   if (($finfo = finfo_open()) === false)
   {
-    error_log("Internal error. Failed to initialize finfo().\n");
+    error_log("Internal error. Failed to initialize finfo().");
     return stError("Internal error, failed to probe file.");
   }
 
@@ -1013,7 +1013,7 @@
   // Did we get anything?
   if ($sdata === FALSE || $smime === FALSE)
   {
-    error_log("Failed to probe file '".$filename."'.\n");
+    error_log("Failed to probe file '".$filename."'.");
     return stError("Internal error, failed to probe file.");
   }
 
@@ -1032,7 +1032,8 @@
       return $fdata;
   }
 
-  return stError("No matching allowed file type found.");
+  error_log("File '".$filename."' (".$smime.") did not match any allowed file types.");
+  return stError("No matching allowed file type found for '".$smime."'.");
 }
 
 
@@ -1186,7 +1187,7 @@
   // Set permissions before moving the file
   if (chmod($tmpFilename, stGetSetting($uploadType."PathPerms")) === false)
   {
-    error_log("Could not set permissions for uploaded file '".$tmpFilename."'.\n");
+    error_log("Could not set permissions for uploaded file '".$tmpFilename."'.");
     return stError("Could not set permissions for uploaded file.");
   }
 
@@ -1194,7 +1195,7 @@
   $fullFile = stMakePath(FALSE, FALSE, array(stGetSetting($uploadType."Path"), $compo["cpath"], $filename));
   if (@move_uploaded_file($tmpFilename, $fullFile) === false)
   {
-    error_log("Could not move uploaded file '".$tmpFilename."' to '".$fullFile."'.\n");
+    error_log("Could not move uploaded file '".$tmpFilename."' to '".$fullFile."'.");
     return stError("Deploying uploaded file failed.");
   }