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
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
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] );
}
}
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" );
* 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;
}
} else {
$msg = $this->msg( $name )->inContentLanguage();
- if ( $msg->isDisabled() ) {
+ if ( $msg->isBlank() ) {
+ return '';
+ } elseif ( $msg->isDisabled() ) {
return false;
}
$notice = $msg->plain();
$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' );
}
}
$text = $msg->text();
} else {
global $wgContLang;
- $text = $wgContLang->getFormattedNsText(
+ $text = $wgContLang->getConverter()->convertNamespace(
MWNamespace::getSubject( $title->getNamespace() ) );
}
}
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' ) ) {
'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;
*/
protected function getWatchlistInfo() {
$titles = array();
- $dbr = wfGetDB( DB_MASTER );
+ $dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select(
array( 'watchlist' ),
),
'dependencies' => array(
'mediawiki.api.edit',
+ 'mediawiki.messagePoster',
),
'targets' => array( 'desktop', 'mobile' ),
),
* 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
* 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,