diff options
author | Morris Jobke <morris.jobke@gmail.com> | 2013-11-27 14:10:11 -0800 |
---|---|---|
committer | Morris Jobke <morris.jobke@gmail.com> | 2013-11-27 14:10:11 -0800 |
commit | 54b24ca88d34bfdafaeecb12c9c8ba85e21de8f7 (patch) | |
tree | ab7a5d00e1e593522abc186cb029fef560aec703 /apps/files_encryption/lib | |
parent | 5295993144bf7a67fdcd48c9f8e99e336fd1293e (diff) | |
parent | 55d7cf8ffd1170f2397fecefaeef5749bb182f32 (diff) | |
download | nextcloud-server-54b24ca88d34bfdafaeecb12c9c8ba85e21de8f7.tar.gz nextcloud-server-54b24ca88d34bfdafaeecb12c9c8ba85e21de8f7.zip |
Merge pull request #6048 from owncloud/encryption_initial_enc_indicator
show a message at the log-in screen if inital encryption take place
Diffstat (limited to 'apps/files_encryption/lib')
-rw-r--r-- | apps/files_encryption/lib/util.php | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index 33ab3f56965..434ed225644 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1245,7 +1245,6 @@ class Util { $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?'; $args = array($this->userId); - $query = \OCP\DB::prepare($sql); $result = $query->execute($args); @@ -1266,20 +1265,23 @@ class Util { // 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); - // insert missing entry in DB with status open - $sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`,`migration_status`) VALUES (?,?,?,?)'; - $args = array( - $this->userId, - 'server-side', - 0, - self::MIGRATION_OPEN - ); - $query = \OCP\DB::prepare($sql); - $query->execute($args); - - return self::MIGRATION_OPEN; - // If a record is found - } else { + // insert missing entry in DB with status open if the user exists + if (\OCP\User::userExists($this->userId)) { + $sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`,`migration_status`) VALUES (?,?,?,?)'; + $args = array( + $this->userId, + 'server-side', + 0, + self::MIGRATION_OPEN + ); + $query = \OCP\DB::prepare($sql); + $query->execute($args); + + return self::MIGRATION_OPEN; + } else { + return false; + } + } else { // If a record is found return (int)$migrationStatus[0]; } |