Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-12-19 18:45:37 +0400
committerVincent Petry <pvince81@owncloud.com>2013-12-19 18:45:37 +0400
commitc4c972fd2fd25a8f83f785f8fba8d98ce3e5041a (patch)
treec4eeb3a0d00f98e7b5ae8aacda135ff73e3c9367 /apps/files_encryption
parent6de259e0acafac30a5aa681562b25e7b7af0d6b7 (diff)
parent1f93b4e842129929ba0eb1e3927c2a0f89552770 (diff)
Merge pull request #6498 from owncloud/stable6-oracleencryptiontestfix
[stable6] Trying to fix failing encryption tests on Oracle
Diffstat (limited to 'apps/files_encryption')
-rw-r--r--apps/files_encryption/lib/util.php46
1 files changed, 17 insertions, 29 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index d4aa4d31649..8e1928aae9a 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -241,11 +241,9 @@ class Util {
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $row = $result->fetchRow();
- if (isset($row['recovery_enabled'])) {
- $recoveryEnabled[] = $row['recovery_enabled'];
- }
+ $row = $result->fetchRow();
+ if ($row && isset($row['recovery_enabled'])) {
+ $recoveryEnabled[] = $row['recovery_enabled'];
}
}
@@ -289,7 +287,7 @@ class Util {
$sql = 'UPDATE `*PREFIX*encryption` SET `recovery_enabled` = ? WHERE `uid` = ?';
$args = array(
- $enabled,
+ $enabled ? '1' : '0',
$this->userId
);
@@ -987,8 +985,8 @@ class Util {
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $row = $result->fetchRow();
+ $row = $result->fetchRow();
+ if ($row) {
$path = substr($row['path'], strlen('files'));
}
}
@@ -1268,11 +1266,9 @@ class Util {
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $row = $result->fetchRow();
- if (isset($row['migration_status'])) {
- $migrationStatus[] = $row['migration_status'];
- }
+ $row = $result->fetchRow();
+ if ($row && isset($row['migration_status'])) {
+ $migrationStatus[] = $row['migration_status'];
}
}
@@ -1452,9 +1448,7 @@ class Util {
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $row = $result->fetchRow();
- }
+ $row = $result->fetchRow();
}
return $row;
@@ -1478,9 +1472,7 @@ class Util {
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $row = $result->fetchRow();
- }
+ $row = $result->fetchRow();
}
return $row;
@@ -1499,18 +1491,16 @@ class Util {
$result = $query->execute(array($id));
- $source = array();
+ $source = null;
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $source = $result->fetchRow();
- }
+ $source = $result->fetchRow();
}
$fileOwner = false;
- if (isset($source['parent'])) {
+ if ($source && isset($source['parent'])) {
$parent = $source['parent'];
@@ -1520,16 +1510,14 @@ class Util {
$result = $query->execute(array($parent));
- $item = array();
+ $item = null;
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('Encryption library', \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
} else {
- if ($result->numRows() > 0) {
- $item = $result->fetchRow();
- }
+ $item = $result->fetchRow();
}
- if (isset($item['parent'])) {
+ if ($item && isset($item['parent'])) {
$parent = $item['parent'];