aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Schießle <bjoern@schiessle.org>2013-12-09 04:57:34 -0800
committerBjörn Schießle <bjoern@schiessle.org>2013-12-09 04:57:34 -0800
commite3822ef76dd000cff80b00e8414870aea08d755b (patch)
treebce0b053283ba493ce586362bbf5703064f52a1c
parent516e5f2ebe03f986a1a95a77656f20bdd5ed9fc4 (diff)
parent00cdb380e52955f97950b44efdbb9f74981262cc (diff)
downloadnextcloud-server-e3822ef76dd000cff80b00e8414870aea08d755b.tar.gz
nextcloud-server-e3822ef76dd000cff80b00e8414870aea08d755b.zip
Merge pull request #6258 from owncloud/stable5_enc_fix_public_access
don't check migration status if a file is accessed by a public link
-rw-r--r--apps/files_encryption/lib/util.php47
1 files changed, 27 insertions, 20 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index 121b1c4f573..7e88026d308 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1142,34 +1142,41 @@ class Util {
*/
public function getMigrationStatus() {
- $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?';
+ if ($this->isPublic) {
- $args = array($this->userId);
+ return self::MIGRATION_COMPLETED;
+
+ } else {
- $query = \OCP\DB::prepare($sql);
+ $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?';
- $result = $query->execute($args);
+ $args = array($this->userId);
+
+ $query = \OCP\DB::prepare($sql);
- $migrationStatus = array();
+ $result = $query->execute($args);
- 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'];
+ $migrationStatus = array();
+
+ 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'];
+ }
}
}
- }
- // If no record is found
- if (empty($migrationStatus)) {
- \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR);
- return false;
- // If a record is found
- } else {
- return (int)$migrationStatus[0];
+ // If no record is found
+ if (empty($migrationStatus)) {
+ \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR);
+ return false;
+ // If a record is found
+ } else {
+ return (int) $migrationStatus[0];
+ }
}
}