From 9a6cd89a69783d35726e6963eabe51e34ce2e878 Mon Sep 17 00:00:00 2001 From: Florin Peter Date: Sat, 25 May 2013 21:33:05 +0200 Subject: [PATCH] added OC_DB::isError and logging --- apps/files_encryption/lib/util.php | 38 ++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 2980aa94e0..9259f521d1 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -291,6 +291,10 @@ class Util $recoveryEnabled = array(); + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + while ( $row = $result->fetchRow() ) { $recoveryEnabled[] = $row['recovery_enabled']; @@ -820,6 +824,10 @@ class Util $result = $query->execute( array( $fileId ) ); + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + $row = $result->fetchRow(); return substr( $row['path'], 5 ); @@ -1086,6 +1094,10 @@ class Util $migrationStatus = array(); + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + $row = $result->fetchRow(); if($row) { $migrationStatus[] = $row['migration_status']; @@ -1221,6 +1233,10 @@ class Util $result = $query->execute( array( $id ) ); + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + $row = $result->fetchRow(); return $row; @@ -1240,6 +1256,10 @@ class Util $result = $query->execute( array( $id ) ); + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + $row = $result->fetchRow(); return $row; @@ -1255,7 +1275,14 @@ class Util public function getOwnerFromSharedFile( $id ) { $query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 ); - $source = $query->execute( array( $id ) )->fetchRow(); + + $result = $query->execute( array( $id ) ); + + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + + $source = $result->fetchRow(); $fileOwner = false; @@ -1266,7 +1293,14 @@ class Util while ( isset( $parent ) ) { $query = \OC_DB::prepare( 'SELECT `parent`, `uid_owner` FROM `*PREFIX*share` WHERE `id` = ?', 1 ); - $item = $query->execute( array( $parent ) )->fetchRow(); + + $result = $query->execute( array( $parent ) ); + + if (\OC_DB::isError($result)) { + \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } + + $item = $result->fetchRow(); if ( isset( $item['parent'] ) ) {