From 226296e3a8bbfa59b87de4e529733eafa5ee2260 Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Fri, 30 May 2014 16:54:34 +0200 Subject: [PATCH] Added Log to Database --- php/modules/Database.php | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/php/modules/Database.php b/php/modules/Database.php index 3ef3e51..aeebd19 100755 --- a/php/modules/Database.php +++ b/php/modules/Database.php @@ -140,16 +140,28 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); $query = @file_get_contents($file); # Create table - if (!isset($query)||$query===false) return false; - if (!$database->query($query)) return false; + if (!isset($query)||$query===false) { + Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_settings'); + return false; + } + if (!$database->query($query)) { + Log::error($database, __METHOD__, __LINE__, $database->error); + return false; + } # Read file $file = __DIR__ . '/../database/settings_content.sql'; $query = @file_get_contents($file); # Add content - if (!isset($query)||$query===false) return false; - if (!$database->query($query)) return false; + if (!isset($query)||$query===false) { + Log::error($database, __METHOD__, __LINE__, 'Could not load content-query for lychee_settings'); + return false; + } + if (!$database->query($query)) { + Log::error($database, __METHOD__, __LINE__, $database->error); + return false; + } } @@ -161,8 +173,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); $query = @file_get_contents($file); # Create table - if (!isset($query)||$query===false) return false; - if (!$database->query($query)) return false; + if (!isset($query)||$query===false) { + Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_albums'); + return false; + } + if (!$database->query($query)) { + Log::error($database, __METHOD__, __LINE__, $database->error); + return false; + } } @@ -174,8 +192,14 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!'); $query = @file_get_contents($file); # Create table - if (!isset($query)||$query===false) return false; - if (!$database->query($query)) return false; + if (!isset($query)||$query===false) { + Log::error($database, __METHOD__, __LINE__, 'Could not load query for lychee_photos'); + return false; + } + if (!$database->query($query)) { + Log::error($database, __METHOD__, __LINE__, $database->error); + return false; + } }