/** * 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(); }
/** * Log a promotion to global rename in the global rename log * * @param string $oldName * @param string $wiki * @param string $newName * @param string $reason */ protected function logPromotionRename($oldName, $wiki, $newName, $reason) { $logger = new GlobalRenameUserLogger($this->getUser()); $logger->logPromotion($oldName, $wiki, $newName, $reason); }