From d6fb2afa8580b7d12b1f0cfc2bb8fb29e01a087f Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Mon, 25 Nov 2013 23:49:05 +0100 Subject: show a message at the log-in screen if inital encryption take place --- apps/files_encryption/lib/util.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'apps/files_encryption/lib/util.php') 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 -- cgit v1.2.3