Put status handling in EditPage into private function

This bit of code is isolated enough to be separated from
attemptSave and be put into a private function.

Change-Id: I84c532358ee32fec959039c62798e4de0702f14a
This commit is contained in:
aude 2013-11-18 22:24:59 +01:00
parent 4910f271f1
commit b2272f43ff

View file

@ -1204,13 +1204,29 @@ class EditPage {
* @throws UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
* @return bool false if output is done, true if the rest of the form should be displayed
*/
function attemptSave() {
global $wgUser, $wgOut;
public function attemptSave() {
global $wgUser;
$resultDetails = false;
# Allow bots to exempt some edits from bot flagging
$bot = $wgUser->isAllowed( 'bot' ) && $this->bot;
$status = $this->internalAttemptSave( $resultDetails, $bot );
return $this->handleStatus( $status, $resultDetails );
}
/**
* Handle status, such as after attempt save
*
* @param Status $status
* @param array|bool $resultDetails
*
* @throws ErrorPageError
* return bool false, if output is done, true if rest of the form should be displayed
*/
private function handleStatus( Status $status, $resultDetails ) {
global $wgUser, $wgOut;
// FIXME: once the interface for internalAttemptSave() is made nicer, this should use the message in $status
if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) {
$this->didSave = true;