X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FEditPage.php;h=814c248304a0f03bfc7a3730a7c19e8453f96063;hp=098ffbf791015ea7f69cb7cb3a65681b5b3959fe;hb=7ececd89751310a7d46310b10ca80d5a0aa77528;hpb=2b5fe6e3f1d01d8b24a1856f016c3c6d120a8855 diff --git a/includes/EditPage.php b/includes/EditPage.php index 098ffbf791..814c248304 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1493,6 +1493,20 @@ class EditPage { return $status; } + /** + * Log when a page was successfully saved after the edit conflict view + */ + private function incrementResolvedConflicts() { + global $wgRequest; + + if ( $wgRequest->getText( 'mode' ) !== 'conflict' ) { + return; + } + + $stats = MediaWikiServices::getInstance()->getStatsdDataFactory(); + $stats->increment( 'edit.failures.conflict.resolved' ); + } + /** * Handle status, such as after attempt save * @@ -1512,6 +1526,8 @@ class EditPage { if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) { + $this->incrementResolvedConflicts(); + $this->didSave = true; if ( !$resultDetails['nullEdit'] ) { $this->setPostEditCookie( $status->value ); @@ -2908,7 +2924,7 @@ class EditPage { } } - $buttonLabelKey = $this->getSaveButtonLabel(); + $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text(); if ( $this->missingComment ) { $wgOut->wrapWikiMsg( "
\n$1\n
", 'missingcommenttext' ); @@ -2917,28 +2933,28 @@ class EditPage { if ( $this->missingSummary && $this->section != 'new' ) { $wgOut->wrapWikiMsg( "
\n$1\n
", - [ 'missingsummary', $buttonLabelKey ] + [ 'missingsummary', $buttonLabel ] ); } if ( $this->missingSummary && $this->section == 'new' ) { $wgOut->wrapWikiMsg( "
\n$1\n
", - [ 'missingcommentheader', $buttonLabelKey ] + [ 'missingcommentheader', $buttonLabel ] ); } if ( $this->blankArticle ) { $wgOut->wrapWikiMsg( "
\n$1\n
", - [ 'blankarticle', $buttonLabelKey ] + [ 'blankarticle', $buttonLabel ] ); } if ( $this->selfRedirect ) { $wgOut->wrapWikiMsg( "
\n$1\n
", - [ 'selfredirect', $buttonLabelKey ] + [ 'selfredirect', $buttonLabel ] ); } @@ -3059,7 +3075,7 @@ class EditPage { 'id' => 'wpSummary', 'name' => 'wpSummary', 'maxlength' => '200', - 'tabindex' => '1', + 'tabindex' => 1, 'size' => 60, 'spellcheck' => 'true', ] + Linker::tooltipAndAccesskeyAttribs( 'summary' ); @@ -3119,6 +3135,10 @@ class EditPage { $this->getSummaryInputAttributes( $inputAttrs ) ); + // For compatibility with old scripts and extensions, we want the legacy 'id' on the `` + $inputAttrs['inputId'] = $inputAttrs['id']; + $inputAttrs['id'] = 'wpSummaryWidget'; + return new OOUI\FieldLayout( new OOUI\TextInputWidget( [ 'value' => $summary, @@ -4268,7 +4288,8 @@ HTML new OOUI\CheckboxInputWidget( [ 'tabIndex' => ++$tabindex, 'accessKey' => $accesskey, - 'id' => $options['id'], + 'id' => $options['id'] . 'Widget', + 'inputId' => $options['id'], 'name' => $name, 'selected' => $options['default'], 'infusable' => true, @@ -4327,10 +4348,9 @@ HTML public function getEditButtons( &$tabindex ) { $buttons = []; - $buttonLabelKey = $this->getSaveButtonLabel(); + $buttonLabel = $this->context->msg( $this->getSaveButtonLabel() )->text(); $attribs = [ - 'id' => 'wpSave', 'name' => 'wpSave', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'save' ); @@ -4338,29 +4358,32 @@ HTML if ( $this->oouiEnabled ) { $saveConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['save'] = new OOUI\ButtonInputWidget( [ + 'id' => 'wpSaveWidget', + 'inputId' => 'wpSave', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked 'useInputTag' => true, 'flags' => [ 'constructive', 'primary' ], - 'label' => $this->context->msg( $buttonLabelKey )->text(), + 'label' => $buttonLabel, 'infusable' => true, 'type' => 'submit', ] + $saveConfig ); } else { $buttons['save'] = Html::submitButton( - $this->context->msg( $buttonLabelKey )->text(), - $attribs, + $buttonLabel, + $attribs + [ 'id' => 'wpSave' ], [ 'mw-ui-progressive' ] ); } $attribs = [ - 'id' => 'wpPreview', 'name' => 'wpPreview', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'preview' ); if ( $this->oouiEnabled ) { $previewConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['preview'] = new OOUI\ButtonInputWidget( [ + 'id' => 'wpPreviewWidget', + 'inputId' => 'wpPreview', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked 'useInputTag' => true, 'label' => $this->context->msg( 'showpreview' )->text(), @@ -4370,17 +4393,18 @@ HTML } else { $buttons['preview'] = Html::submitButton( $this->context->msg( 'showpreview' )->text(), - $attribs + $attribs + [ 'id' => 'wpPreview' ] ); } $attribs = [ - 'id' => 'wpDiff', 'name' => 'wpDiff', 'tabindex' => ++$tabindex, ] + Linker::tooltipAndAccesskeyAttribs( 'diff' ); if ( $this->oouiEnabled ) { $diffConfig = OOUI\Element::configFromHtmlAttributes( $attribs ); $buttons['diff'] = new OOUI\ButtonInputWidget( [ + 'id' => 'wpDiffWidget', + 'inputId' => 'wpDiff', // Support: IE 6 – Use , otherwise it can't distinguish which button was clicked 'useInputTag' => true, 'label' => $this->context->msg( 'showdiff' )->text(), @@ -4390,7 +4414,7 @@ HTML } else { $buttons['diff'] = Html::submitButton( $this->context->msg( 'showdiff' )->text(), - $attribs + $attribs + [ 'id' => 'wpDiff' ] ); } @@ -4697,7 +4721,7 @@ HTML protected function addExplainConflictHeader( OutputPage $out ) { $out->wrapWikiMsg( "
\n$1\n
", - [ 'explainconflict', $this->getSaveButtonLabel() ] + [ 'explainconflict', $this->context->msg( $this->getSaveButtonLabel() )->text() ] ); }