function onSubmit(array $data) { if (!isset($data['username'])) { $this->showCurrentRenames(); return false; } $name = User::getCanonicalName($data['username'], 'usable'); if (!$name) { $this->showCurrentRenames(); return false; } $out = $this->getOutput(); $this->renameuserStatus = new GlobalRenameUserStatus($name); $names = $this->renameuserStatus->getNames(); if (!$names) { $this->checkCachePurge($name); $out->addWikiMsg('centralauth-rename-notinprogress', $name); $this->getForm()->displayForm(false); $this->showLogExtract($name); return true; } list($oldName, $newName) = $names; $statuses = $this->renameuserStatus->getStatuses(); $this->getForm()->displayForm(false); // $newname will always be defined since we check // for 0 result rows above $caUser = new CentralAuthUser($newName); $attached = $caUser->listAttached(); foreach ($attached as $wiki) { // If it's not in the db table, and there is // an attached acount, assume it's done. if (!isset($statuses[$wiki])) { $statuses[$wiki] = 'done'; } } ksort($statuses); $table = Html::openElement('table', array('class' => 'wikitable sortable')); $table .= Html::openElement('tr'); $table .= Html::element('th', array(), $this->msg('centralauth-rename-table-domain')->text()); $table .= Html::element('th', array(), $this->msg('centralauth-rename-table-status')->text()); $table .= Html::closeElement('tr'); foreach ($statuses as $wiki => $status) { $table .= Html::openElement('tr'); $table .= Html::element('td', array(), WikiMap::getWiki($wiki)->getDisplayName()); // Messages used: centralauth-rename-table-status-inprogress // centralauth-rename-table-status-queued, centralauth-rename-table-status-done $table .= Html::rawElement('td', array(), $this->msg("centralauth-rename-table-status-{$status}")->parse()); $table .= Html::closeElement('tr'); } $table .= Html::closeElement('table'); $fieldset = Xml::fieldset($this->msg('centralauth-rename-progress-fieldset')->text(), $table); $this->showLogExtract($newName); $out->addHTML($fieldset); return true; }
private function showRenameInProgressError() { $this->showError('centralauth-admin-rename-in-progress', $this->mUserName); $special = new SpecialGlobalRenameProgress(); $special->setContext($this->getContext()); $renameStatus = new GlobalRenameUserStatus($this->mUserName); $names = $renameStatus->getNames(); $special->showLogExtract($names[1]); }
/** * Same as $this->renameInProgress, but only checks one wiki * Not cached * @see CentralAuthUser::renameInProgress * @param string $wiki * @return array|bool */ public function renameInProgressOn($wiki) { $renameState = new GlobalRenameUserStatus($this->mName); // Use master as this is being used for various critical things $names = $renameState->getNames($wiki, 'master'); if ($names) { return $names; } else { return false; } }