Browse Source

Added error logging to Album class (#143)

Tobias Reich 10 years ago
parent
commit
83188ae9d9
1 changed files with 24 additions and 6 deletions
  1. 24 6
      php/modules/Album.php

+ 24 - 6
php/modules/Album.php

@@ -44,7 +44,10 @@ class Album extends Module {
 		# Call plugins
 		$this->plugins(__METHOD__, 1, func_get_args());
 
-		if (!$result) return false;
+		if (!$result) {
+			Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+			return false;
+		}
 		return $this->database->insert_id;
 
 	}
@@ -346,7 +349,10 @@ class Album extends Module {
 		# Call plugins
 		$this->plugins(__METHOD__, 1, func_get_args());
 
-		if (!$result) return false;
+		if (!$result) {
+			Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+			return false;
+		}
 		return true;
 
 	}
@@ -369,7 +375,10 @@ class Album extends Module {
 		# Call plugins
 		$this->plugins(__METHOD__, 1, func_get_args());
 
-		if (!$result) return false;
+		if (!$result) {
+			Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+			return false;
+		}
 		return true;
 
 	}
@@ -414,12 +423,18 @@ class Album extends Module {
 
 			# Set public
 			$result = $this->database->query("UPDATE lychee_albums SET public = '$public', password = NULL WHERE id = '$album->id';");
-			if (!$result) return false;
+			if (!$result) {
+				Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+				return false;
+			}
 
 			# Reset permissions for photos
 			if ($public===1) {
 				$result = $this->database->query("UPDATE lychee_photos SET public = 0 WHERE album = '$album->id';");
-				if (!$result) return false;
+				if (!$result) {
+					Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+					return false;
+				}
 			}
 
 		}
@@ -460,7 +475,10 @@ class Album extends Module {
 		# Call plugins
 		$this->plugins(__METHOD__, 1, func_get_args());
 
-		if (!$result) return false;
+		if (!$result) {
+			Log::error($this->database, __METHOD__, __LINE__, $this->database->error);
+			return false;
+		}
 		return true;
 
 	}