set the init status to "NOT_INITIALIZED" if the encryption app gets enabled

This commit is contained in:
Bjoern Schiessle 2013-10-22 16:15:24 +02:00
parent bd450d6f6b
commit eb348b776c
3 changed files with 14 additions and 1 deletions

View File

@ -555,4 +555,16 @@ class Hooks {
} }
} }
/**
* set the init status to 'NOT_INITIALIZED' (0) if the app gets enabled
* @param array $params contains the app ID
*/
public static function postEnable($params) {
error_log("app was enabled!");
if ($params['app'] === 'files_encryption') {
$session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
$session->setInitialized(\OCA\Encryption\Session::NOT_INITIALIZED);
}
}
} }

View File

@ -69,6 +69,7 @@ class Helper {
public static function registerAppHooks() { public static function registerAppHooks() {
\OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable'); \OCP\Util::connectHook('OC_App', 'pre_disable', 'OCA\Encryption\Hooks', 'preDisable');
\OCP\Util::connectHook('OC_App', 'post_disable', 'OCA\Encryption\Hooks', 'postEnable');
} }
/** /**

View File

@ -1278,7 +1278,7 @@ class Util {
// If no record is found // If no record is found
if (empty($migrationStatus)) { 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 " . $this->userId . ", no record found", \OCP\Util::ERROR);
return false; return self::MIGRATION_OPEN;
// If a record is found // If a record is found
} else { } else {
return (int)$migrationStatus[0]; return (int)$migrationStatus[0];