Merge "Made replaceSectionContent try to use DB_SLAVE"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 7 Apr 2015 09:29:54 +0000 (09:29 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 7 Apr 2015 09:29:54 +0000 (09:29 +0000)
RELEASE-NOTES-1.25
includes/MediaWiki.php
includes/api/ApiQueryLogEvents.php
includes/page/WikiPage.php
includes/skins/Skin.php
includes/skins/SkinTemplate.php
includes/specials/SpecialBlockList.php
includes/specials/SpecialEditWatchlist.php
resources/Resources.php
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js
resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js

index 1ec8b93..7fc13bd 100644 (file)
@@ -119,6 +119,9 @@ production.
   proper, published library, which is now tagged as v1.0.0.
 * A new message (defaulting to blank), 'editnotice-notext', can be shown to users
   when they are editing if no edit notices apply to the page being edited.
+* (T94536) You can now make the sitenotice appear to logged-in users only by
+  editing MediaWiki:Anonnotice and replacing its content with "". Setting it to
+  "-" (default) will continue disable it and fallback to MediaWiki:Sitenotice.
 
 ==== External libraries ====
 * MediaWiki now requires certain external libraries to be installed. In the past
index 68d03c8..86531bb 100644 (file)
@@ -529,7 +529,7 @@ class MediaWiki {
                                        wfDebugLog( 'RedirectedPosts', "Redirected from HTTP to HTTPS: $oldUrl" );
                                }
                                // Setup dummy Title, otherwise OutputPage::redirect will fail
-                               $title = Title::newFromText( NS_MAIN, 'REDIR' );
+                               $title = Title::newFromText( 'REDIR', NS_MAIN );
                                $this->context->setTitle( $title );
                                $output = $this->context->getOutput();
                                // Since we only do this redir to change proto, always send a vary header
index adf96fd..a9349b1 100644 (file)
@@ -366,11 +366,11 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                                unset( $params[$idsKey] );
                                        }
                                        if ( isset( $params[$ofieldKey] ) ) {
-                                               $params[] = $params[$ofieldKey];
+                                               $params[] = 'ofield=' . $params[$ofieldKey];
                                                unset( $params[$ofieldKey] );
                                        }
                                        if ( isset( $params[$nfieldKey] ) ) {
-                                               $params[] = $params[$nfieldKey];
+                                               $params[] = 'nfield=' . $params[$nfieldKey];
                                                unset( $params[$nfieldKey] );
                                        }
                                }
index eb8532f..6bde176 100644 (file)
@@ -1563,10 +1563,7 @@ class WikiPage implements Page, IDBAccessObject {
                        if ( is_null( $baseRevId ) || $sectionId === 'new' ) {
                                $oldContent = $this->getContent();
                        } else {
-                               // TODO: try DB_SLAVE first
-                               $dbw = wfGetDB( DB_MASTER );
-                               $rev = Revision::loadFromId( $dbw, $baseRevId );
-
+                               $rev = Revision::newFromId( $baseRevId );
                                if ( !$rev ) {
                                        wfDebug( __METHOD__ . " asked for bogus section (page: " .
                                                $this->getId() . "; section: $sectionId)\n" );
index dc25c6c..ac7a85b 100644 (file)
@@ -1477,7 +1477,8 @@ abstract class Skin extends ContextSource {
         * Get a cached notice
         *
         * @param string $name Message name, or 'default' for $wgSiteNotice
-        * @return string HTML fragment
+        * @return string|bool HTML fragment, or false to indicate that the caller
+        *   should fall back to the next notice in its sequence
         */
        private function getCachedNotice( $name ) {
                global $wgRenderHashAppend, $parserMemc, $wgContLang;
@@ -1493,7 +1494,9 @@ abstract class Skin extends ContextSource {
                        }
                } else {
                        $msg = $this->msg( $name )->inContentLanguage();
-                       if ( $msg->isDisabled() ) {
+                       if ( $msg->isBlank() ) {
+                               return '';
+                       } elseif ( $msg->isDisabled() ) {
                                return false;
                        }
                        $notice = $msg->plain();
@@ -1554,13 +1557,13 @@ abstract class Skin extends ContextSource {
                                $siteNotice = $this->getCachedNotice( 'sitenotice' );
                        } else {
                                $anonNotice = $this->getCachedNotice( 'anonnotice' );
-                               if ( !$anonNotice ) {
+                               if ( $anonNotice === false ) {
                                        $siteNotice = $this->getCachedNotice( 'sitenotice' );
                                } else {
                                        $siteNotice = $anonNotice;
                                }
                        }
-                       if ( !$siteNotice ) {
+                       if ( $siteNotice === false ) {
                                $siteNotice = $this->getCachedNotice( 'default' );
                        }
                }
index b0390e9..61aad92 100644 (file)
@@ -717,7 +717,7 @@ class SkinTemplate extends Skin {
                        $text = $msg->text();
                } else {
                        global $wgContLang;
-                       $text = $wgContLang->getFormattedNsText(
+                       $text = $wgContLang->getConverter()->convertNamespace(
                                MWNamespace::getSubject( $title->getNamespace() ) );
                }
 
index 4583430..0ec144a 100644 (file)
@@ -113,11 +113,6 @@ class SpecialBlockList extends SpecialPage {
        }
 
        function showList() {
-               # Purge expired entries on one in every 10 queries
-               if ( !mt_rand( 0, 10 ) ) {
-                       Block::purgeExpired();
-               }
-
                $conds = array();
                # Is the user allowed to see hidden blocks?
                if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
@@ -398,6 +393,10 @@ class BlockListPager extends TablePager {
                        'join_conds' => array( 'user' => array( 'LEFT JOIN', 'user_id = ipb_by' ) )
                );
 
+               # Filter out any expired blocks
+               $db = $this->getDatabase();
+               $info['conds'][] = 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() );
+
                # Is the user allowed to see hidden blocks?
                if ( !$this->getUser()->isAllowed( 'hideuser' ) ) {
                        $info['conds']['ipb_deleted'] = 0;
index ffe7892..910fe25 100644 (file)
@@ -344,7 +344,7 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
         */
        protected function getWatchlistInfo() {
                $titles = array();
-               $dbr = wfGetDB( DB_MASTER );
+               $dbr = wfGetDB( DB_SLAVE );
 
                $res = $dbr->select(
                        array( 'watchlist' ),
index cbe6b82..e56d557 100644 (file)
@@ -974,6 +974,7 @@ return array(
                ),
                'dependencies' => array(
                        'mediawiki.api.edit',
+                       'mediawiki.messagePoster',
                ),
                'targets' => array( 'desktop', 'mobile' ),
        ),
index b021558..91366ff 100644 (file)
         *   by MessagePosters that require one, unless the message already contains the string
         *   ~~~.
         * @return {jQuery.Promise} Promise completing when the post succeeds or fails.
-        * @return {Function} return.done
-        * @return {Function} return.fail
-        * @return {string} return.fail.primaryError Primary error code.  For a mw.Api failure,
-        *   this should be 'api-fail'.
-        * @return {string} return.fail.secondaryError Secondary error code.  For a mw.Api failure,
-        *   this, should be mw.Api's code, e.g. 'http', 'ok-but-empty', or the error passed through
-        *   from the server.
-        * @return {Mixed} return.fail.details Further details about the error
+        *   For failure, will be rejected with three arguments:
+        *
+        *   - primaryError - Primary error code.  For a mw.Api failure,
+        *       this should be 'api-fail'.
+        *   - secondaryError - Secondary error code.  For a mw.Api failure,
+        *       this, should be mw.Api's code, e.g. 'http', 'ok-but-empty', or the error passed through
+        *       from the server.
+        *   - details - Further details about the error
         *
         * @localdoc
         * The base class currently does nothing, but could be used for shared analytics or
index 098bc88..9d28080 100644 (file)
         * API and ResourceLoader requests in the background.
         *
         * @param {mw.Title} title Title that will be posted to
-        * @return {jQuery.Promise} Promise for the MessagePoster
-        * @return {Function} return.done Called if MessagePoster is retrieved
-        * @return {mw.messagePoster.MessagePoster} return.done.poster MessagePoster
-        * @return {Function} return.fail Called if MessagePoster could not be constructed
-        * @return {string} return.fail.errorCode String error code
+        * @return {jQuery.Promise} Promise resolving to a mw.messagePoster.MessagePoster.
+        *   For failure, rejected with up to three arguments:
+        *
+        *   - errorCode Error code string
+        *   - error Error explanation
+        *   - details Further error details
         */
        MwMessagePosterFactory.prototype.create = function ( title ) {
                var pageId, page, contentModel, moduleName,