Merge pull request #5472 from owncloud/enc_init_status_on_enable
Encryption set init status on enable
This commit is contained in:
commit
2d14daf36b
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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];
|
||||||
|
|
|
@ -249,6 +249,7 @@ class OC_App{
|
||||||
if(isset($appdata['id'])) {
|
if(isset($appdata['id'])) {
|
||||||
OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] );
|
OC_Appconfig::setValue( $app, 'ocsid', $appdata['id'] );
|
||||||
}
|
}
|
||||||
|
\OC_Hook::emit('OC_App', 'post_enable', array('app' => $app));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
throw new \Exception($l->t("No app name specified"));
|
throw new \Exception($l->t("No app name specified"));
|
||||||
|
|
Loading…
Reference in New Issue