diff --git a/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php b/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php --- a/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php +++ b/src/applications/auth/editor/PhabricatorAuthSSHKeyEditor.php @@ -197,9 +197,7 @@ // After making any change to an SSH key, drop the authfile cache so it // is regenerated the next time anyone authenticates. - $cache = PhabricatorCaches::getMutableCache(); - $authfile_key = PhabricatorAuthSSHKeyQuery::AUTHFILE_CACHEKEY; - $cache->deleteKey($authfile_key); + PhabricatorAuthSSHKeyQuery::deleteSSHKeyCache(); return $xactions; } diff --git a/src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php b/src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php --- a/src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php +++ b/src/applications/auth/query/PhabricatorAuthSSHKeyQuery.php @@ -11,6 +11,12 @@ private $keys; private $isActive; + public static function deleteSSHKeyCache() { + $cache = PhabricatorCaches::getMutableCache(); + $authfile_key = self::AUTHFILE_CACHEKEY; + $cache->deleteKey($authfile_key); + } + public function withIDs(array $ids) { $this->ids = $ids; return $this; diff --git a/src/applications/people/editor/PhabricatorUserEditor.php b/src/applications/people/editor/PhabricatorUserEditor.php --- a/src/applications/people/editor/PhabricatorUserEditor.php +++ b/src/applications/people/editor/PhabricatorUserEditor.php @@ -195,6 +195,10 @@ $user->saveTransaction(); + // The SSH key cache currently includes usernames, so dirty it. See T12554 + // for discussion. + PhabricatorAuthSSHKeyQuery::deleteSSHKeyCache(); + $user->sendUsernameChangeEmail($actor, $old_username); }