/** * On rename, remove the old entry and add the new * (After a sucessful user rename) * * @param $uid * @param $oldName string * @param $newName string * @return bool */ public static function asAddRenameUserHook($uid, $oldName, $newName) { $spoof = new CentralAuthSpoofUser($newName); $spoof->update($oldName); return true; }
/** * Rename a global user (this assumes that the data has been verified before * and that $newUser is being a creatable user)! * * @param $options array * @return Status */ public function rename(array $options) { $wikis = $this->oldCAUser->listAttached(); $status = $this->setRenameStatuses($wikis); if (!$status->isOK()) { return $status; } $this->databaseUpdates->update($this->oldUser->getName(), $this->newUser->getName()); // Update CA's AntiSpoof if enabled if (class_exists('CentralAuthSpoofUser')) { $spoof = new CentralAuthSpoofUser($this->newUser->getName()); $spoof->update($this->oldUser->getName()); } // From this point on all code using CentralAuthUser // needs to use the new username, except for // the renameInProgress function. Probably. // Clear some caches... $this->oldCAUser->quickInvalidateCache(); $this->newCAUser->quickInvalidateCache(); $this->injectLocalRenameUserJobs($wikis, $options); $this->logger->log($this->oldUser->getName(), $this->newUser->getName(), $options['reason']); return Status::newGood(); }