Merge "Deprecate EditFilterMerged hook, final ContentHandler replaced hook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 15 Oct 2016 06:41:34 +0000 (06:41 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 15 Oct 2016 06:41:34 +0000 (06:41 +0000)
1  2 
RELEASE-NOTES-1.28
includes/EditPage.php

diff --combined RELEASE-NOTES-1.28
@@@ -61,9 -61,6 +61,9 @@@ production
    on the wiki farm with a different domain, MediaWiki will instead alter the redirect
    URL to include a ?cpPosTime parameter that triggers the database synchronization when
    the URL is followed by the client. The same-domain case uses a new cpPosTime cookie.
 +* Added new hooks, 'ApiQueryBaseBeforeQuery', 'ApiQueryBaseAfterQuery', and
 +  'ApiQueryBaseProcessRow', to make it easier for extensions to add 'prop' and
 +  'show' parameters to existing API query modules.
  
  === External library changes in 1.28 ===
  
    module without listing them all explicitly.
  * (T146770) It is now possible to assert that the current user is a specific
    named user, using the 'assertuser' parameter.
 +* (T141963) Added a 'known' property when missing-but-known titles (e.g. from
 +  the 'TitleIsAlwaysKnown' hook) are output in various modules.
  
  === Action API internal changes in 1.28 ===
  * Added a new hook, 'ApiMakeParserOptions', to allow extensions to better
  * ApiResult::setParsedLimit() was removed (deprecated since 1.25)
  * ApiResult::setRawMode() was removed (deprecated since 1.25)
  * ApiResult::size() was removed (deprecated since 1.25)
 +* Added new hooks, 'ApiQueryBaseBeforeQuery', 'ApiQueryBaseAfterQuery', and
 +  'ApiQueryBaseProcessRow', to make it easier for extensions to add 'prop' and
 +  'show' parameters to existing API query modules. A query module can enable
 +  these hooks by passing an array for $hookData to ApiQueryBase::select() and
 +  by calling ApiQueryBase->processRow() before adding a row's data to the
 +  result.
  
  === Languages updated in 1.28 ===
  
@@@ -175,8 -164,7 +175,8 @@@ changes to languages because of Phabric
    BASAbali, M. Adiputra, Naval Scene, Nemo bis, NoiX180, and 아라.
  * (T135867) shn (Shan), thanks to translators Khun Sar, Piangpha,
    Saiddzone Saimawnkham, Saosukham, and Sengwan.
 -* Czech (cs) and Slovak (sk) set as reciprocal fallbacks
 +* Czech (cs) and Slovak (sk) set as reciprocal fallbacks.
 +* (T146744) Livvi-Karelian (olo) namespace messages created thanks to translator Ilja.mos.
  
  === Other changes in 1.28 ===
  * (T128697) Improved handling of large diffs.
    migrate to using the same functions on a ProxyLookup instance, obtainable from
    MediaWikiServices.
  * The ArticleAfterFetchContent, ArticleInsertComplete, ArticleSave, ArticleSaveComplete,
-   ArticleViewCustom, EditPageGetDiffText, EditPageGetPreviewText and ShowRawCssJs hooks
-   will now emit deprecation warnings if used.
+   ArticleViewCustom, EditFilterMerged, EditPageGetDiffText, EditPageGetPreviewText and
+   ShowRawCssJs hooks will now emit deprecation warnings if used.
  
  == Compatibility ==
  
diff --combined includes/EditPage.php
@@@ -1613,7 -1613,8 +1613,8 @@@ class EditPage 
        protected function runPostMergeFilters( Content $content, Status $status, User $user ) {
                // Run old style post-section-merge edit filter
                if ( !ContentHandler::runLegacyHooks( 'EditFilterMerged',
-                       [ $this, $content, &$this->hookError, $this->summary ]
+                       [ $this, $content, &$this->hookError, $this->summary ],
+                       '1.21'
                ) ) {
                        # Error messages etc. could be handled within the hook...
                        $status->fatal( 'hookaborted' );
                                // being set. This is used by ConfirmEdit to display a captcha
                                // without any error message cruft.
                        } else {
 -                              $this->hookError = $status->getWikiText();
 +                              $this->hookError = $this->formatStatusErrors( $status );
                        }
                        // Use the existing $status->value if the hook set it
                        if ( !$status->value ) {
                } elseif ( !$status->isOK() ) {
                        # ...or the hook could be expecting us to produce an error
                        // FIXME this sucks, we should just use the Status object throughout
 -                      $this->hookError = $status->getWikiText();
 +                      $this->hookError = $this->formatStatusErrors( $status );
                        $status->fatal( 'hookaborted' );
                        $status->value = self::AS_HOOK_ERROR_EXPECTED;
                        return false;
                return true;
        }
  
 +      /**
 +       * Wrap status errors in an errorbox for increased visiblity
 +       *
 +       * @param Status $status
 +       * @return string
 +       */
 +      private function formatStatusErrors( Status $status ) {
 +              $errmsg = $status->getHTML(
 +                      'edit-error-short',
 +                      'edit-error-long',
 +                      $this->context->getLanguage()
 +              );
 +              return <<<ERROR
 +<div class="errorbox">
 +{$errmsg}
 +</div>
 +<br clear="all" />
 +ERROR;
 +      }
 +
        /**
         * Return the summary to be used for a new section.
         *
                        'id' => $name,
                        'cols' => $wgUser->getIntOption( 'cols' ),
                        'rows' => $wgUser->getIntOption( 'rows' ),
 -                      // The following classes can be used here:
 -                      // * mw-editfont-default
 -                      // * mw-editfont-monospace
 -                      // * mw-editfont-sans-serif
 -                      // * mw-editfont-serif
 -                      'class' => 'mw-editfont-' . $wgUser->getOption( 'editfont' ),
                        // Avoid PHP notices when appending preferences
                        // (appending allows customAttribs['style'] to still work).
                        'style' => ''
                ];
  
 +              // The following classes can be used here:
 +              // * mw-editfont-default
 +              // * mw-editfont-monospace
 +              // * mw-editfont-sans-serif
 +              // * mw-editfont-serif
 +              $class = 'mw-editfont-' . $wgUser->getOption( 'editfont' );
 +
 +              if ( isset( $attribs['class'] ) ) {
 +                      if ( is_string( $attribs['class'] ) ) {
 +                              $attribs['class'] .= ' ' . $class;
 +                      } elseif ( is_array( $attribs['class'] ) ) {
 +                              $attribs['class'][] = $class;
 +                      }
 +              } else {
 +                      $attribs['class'] = $class;
 +              }
 +
                $pageLang = $this->mTitle->getPageLanguage();
                $attribs['lang'] = $pageLang->getHtmlCode();
                $attribs['dir'] = $pageLang->getDir();