Merge pull request #5472 from owncloud/enc_init_status_on_enable

Encryption set init status on enable
This commit is contained in:
Björn Schießle 2013-10-23 01:02:45 -07:00
commit 2d14daf36b
4 changed files with 14 additions and 1 deletions

View File

@ -555,4 +555,15 @@ 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) {
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() {
\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 (empty($migrationStatus)) {
\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
} else {
return (int)$migrationStatus[0];

View File

@ -249,6 +249,7 @@ class OC_App{
if(isset($appdata['id'])) {
OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] );
}
\OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
}
}else{
throw new \Exception($l->t("No app name specified"));