diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2013-11-25 23:49:05 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2013-11-25 23:49:05 +0100 |
commit | d6fb2afa8580b7d12b1f0cfc2bb8fb29e01a087f (patch) | |
tree | 7630a7591b2ef45117326eba2d9cb33d39bbaec1 /apps/files_encryption/lib/util.php | |
parent | 5310a5924b18849c85b482819c350d72a6d0c67c (diff) | |
download | nextcloud-server-d6fb2afa8580b7d12b1f0cfc2bb8fb29e01a087f.tar.gz nextcloud-server-d6fb2afa8580b7d12b1f0cfc2bb8fb29e01a087f.zip |
show a message at the log-in screen if inital encryption take place
Diffstat (limited to 'apps/files_encryption/lib/util.php')
-rw-r--r-- | apps/files_encryption/lib/util.php | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php index b208a808bac..78d0ff88c8e 100644 --- a/apps/files_encryption/lib/util.php +++ b/apps/files_encryption/lib/util.php @@ -1253,16 +1253,22 @@ class Util { /** * @brief check if files are already migrated to the encryption system + * @param string $uid user Id * @return migration status, false = in case of no record * @note If records are not being returned, check for a hidden space * at the start of the uid in db */ - public function getMigrationStatus() { + public function getMigrationStatus($uid = null) { - $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?'; + if($uid && \OCP\User::userExists($uid)) { + $userId = $uid; + } else { + $userId = $this->uid; + } - $args = array($this->userId); + $sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?'; + $args = array($userId); $query = \OCP\DB::prepare($sql); $result = $query->execute($args); @@ -1282,11 +1288,11 @@ 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); + \OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $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, + $userId, 'server-side', 0, self::MIGRATION_OPEN |