From: Florin Peter Date: Sat, 25 May 2013 21:07:19 +0000 (+0200) Subject: fixed error rising from fetchRow X-Git-Tag: v6.0.0alpha2~727^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=788c5940f08c5380b695c4bf9b69b53af1cd2d59;p=nextcloud-server.git fixed error rising from fetchRow --- diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 9259f521d1a..70fcd955be0 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -293,12 +293,11 @@ class Util 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']; - + } else { + $row = $result->fetchRow(); + if( isset( $row['recovery_enabled'] ) ) { + $recoveryEnabled[] = $row['recovery_enabled']; + } } // If no record is found @@ -824,13 +823,15 @@ class Util $result = $query->execute( array( $fileId ) ); + $path = false; if (\OC_DB::isError($result)) { \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } else { + $row = $result->fetchRow(); + $path = substr( $row['path'], strlen('files') ); } - $row = $result->fetchRow(); - - return substr( $row['path'], 5 ); + return $path; } @@ -1096,11 +1097,11 @@ class Util 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']; + } else { + $row = $result->fetchRow(); + if( isset( $row['migration_status'] ) ) { + $migrationStatus[] = $row['migration_status']; + } } // If no record is found @@ -1233,12 +1234,13 @@ class Util $result = $query->execute( array( $id ) ); + $row = array(); if (\OC_DB::isError($result)) { \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } else { + $row = $result->fetchRow(); } - $row = $result->fetchRow(); - return $row; } @@ -1256,12 +1258,13 @@ class Util $result = $query->execute( array( $id ) ); + $row = array(); if (\OC_DB::isError($result)) { \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } else { + $row = $result->fetchRow(); } - $row = $result->fetchRow(); - return $row; } @@ -1278,12 +1281,13 @@ class Util $result = $query->execute( array( $id ) ); + $source = array(); if (\OC_DB::isError($result)) { \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } else { + $source = $result->fetchRow(); } - $source = $result->fetchRow(); - $fileOwner = false; if ( isset( $source['parent'] ) ) { @@ -1296,12 +1300,13 @@ class Util $result = $query->execute( array( $parent ) ); + $item = array(); if (\OC_DB::isError($result)) { \OC_Log::write('Encryption library', \OC_DB::getErrorMessage($result), \OC_Log::ERROR); + } else { + $item = $result->fetchRow(); } - $item = $result->fetchRow(); - if ( isset( $item['parent'] ) ) { $parent = $item['parent'];