]> source.dussan.org Git - nextcloud-server.git/commitdiff
don't check migration status if a file is accessed by a public link
authorBjoern Schiessle <schiessle@owncloud.com>
Mon, 9 Dec 2013 11:45:19 +0000 (12:45 +0100)
committerBjoern Schiessle <schiessle@owncloud.com>
Mon, 9 Dec 2013 11:45:19 +0000 (12:45 +0100)
apps/files_encryption/lib/util.php

index 121b1c4f573d8e3dee4ac0a4d4422da8400e431a..7e88026d308670b76071ead57a5b03e5f5a34cd4 100644 (file)
@@ -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];
+                       }
                }
 
        }