From: jenkins-bot Date: Tue, 7 Apr 2015 09:29:54 +0000 (+0000) Subject: Merge "Made replaceSectionContent try to use DB_SLAVE" X-Git-Tag: 1.31.0-rc.0~11817 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=051e1abaefe2c9ab0022e1e6f99001c5383eba19;hp=ea21dc244eb0c3ecd796d20022494cbe3d24ccb1;p=lhc%2Fweb%2Fwiklou.git Merge "Made replaceSectionContent try to use DB_SLAVE" --- diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25 index 1ec8b930b4..7fc13bd2a3 100644 --- a/RELEASE-NOTES-1.25 +++ b/RELEASE-NOTES-1.25 @@ -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 diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 68d03c8a56..86531bb9e5 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -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 diff --git a/includes/api/ApiQueryLogEvents.php b/includes/api/ApiQueryLogEvents.php index adf96fd569..a9349b1e56 100644 --- a/includes/api/ApiQueryLogEvents.php +++ b/includes/api/ApiQueryLogEvents.php @@ -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] ); } } diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index eb8532f3cc..6bde176c5b 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -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" ); diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index dc25c6cdc8..ac7a85ba44 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -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' ); } } diff --git a/includes/skins/SkinTemplate.php b/includes/skins/SkinTemplate.php index b0390e9363..61aad92112 100644 --- a/includes/skins/SkinTemplate.php +++ b/includes/skins/SkinTemplate.php @@ -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() ) ); } diff --git a/includes/specials/SpecialBlockList.php b/includes/specials/SpecialBlockList.php index 458343028e..0ec144a206 100644 --- a/includes/specials/SpecialBlockList.php +++ b/includes/specials/SpecialBlockList.php @@ -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; diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index ffe7892e8b..910fe259f1 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -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' ), diff --git a/resources/Resources.php b/resources/Resources.php index cbe6b82e6f..e56d5577c6 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -974,6 +974,7 @@ return array( ), 'dependencies' => array( 'mediawiki.api.edit', + 'mediawiki.messagePoster', ), 'targets' => array( 'desktop', 'mobile' ), ), diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js index b021558193..91366ff593 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.MessagePoster.js @@ -21,14 +21,14 @@ * 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 diff --git a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js index 098bc88075..9d280800bd 100644 --- a/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js +++ b/resources/src/mediawiki.messagePoster/mediawiki.messagePoster.factory.js @@ -50,11 +50,12 @@ * 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,