summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Peter <github@florin-peter.de>2013-05-25 23:07:19 +0200
committerFlorin Peter <github@florin-peter.de>2013-05-25 23:20:55 +0200
commit788c5940f08c5380b695c4bf9b69b53af1cd2d59 (patch)
tree4c4415d1a748e5eee530b9c2186af4caa8264519
parent9a6cd89a69783d35726e6963eabe51e34ce2e878 (diff)
downloadnextcloud-server-788c5940f08c5380b695c4bf9b69b53af1cd2d59.tar.gz
nextcloud-server-788c5940f08c5380b695c4bf9b69b53af1cd2d59.zip
fixed error rising from fetchRow
-rw-r--r--apps/files_encryption/lib/util.php49
1 files changed, 27 insertions, 22 deletions
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'];