try {
$dbw = wfGetDB( DB_MASTER );
- $dbw->startAtomic( __METHOD__ );
$success = $dbw->insert( 'msg_resource', array(
'mr_lang' => $lang,
'mr_resource' => $name,
);
}
}
- $dbw->endAtomic( __METHOD__ );
} catch ( DBError $e ) {
wfDebug( __METHOD__ . " failed to update DB: $e\n" );
}
$feedItems = array();
foreach ( (array)$data['query']['watchlist'] as $info ) {
- $feedItems[] = $this->createFeedItem( $info );
+ $feedItem = $this->createFeedItem( $info );
+ if ( $feedItem ) {
+ $feedItems[] = $feedItem;
+ }
}
$msg = wfMessage( 'watchlist' )->inContentLanguage()->text();
private function createFeedItem( $info ) {
$titleStr = $info['title'];
$title = Title::newFromText( $titleStr );
+ $curidParam = array();
+ if ( !$title || $title->isExternal() ) {
+ // Probably a formerly-valid title that's now conflicting with an
+ // interwiki prefix or the like.
+ if ( isset( $info['pageid'] ) ) {
+ $title = Title::newFromId( $info['pageid'] );
+ $curidParam = array( 'curid' => $info['pageid'] );
+ }
+ if ( !$title || $title->isExternal() ) {
+ return null;
+ }
+ }
if ( isset( $info['revid'] ) ) {
$titleUrl = $title->getFullURL( array( 'diff' => $info['revid'] ) );
} else {
- $titleUrl = $title->getFullURL();
+ $titleUrl = $title->getFullURL( $curidParam );
}
$comment = isset( $info['comment'] ) ? $info['comment'] : null;
global $wgExtraGenderNamespaces;
$ns = $wgExtraGenderNamespaces +
- self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
+ (array)self::$dataCache->getItem( $this->mCode, 'namespaceGenderAliases' );
return isset( $ns[$index][$gender] ) ? $ns[$index][$gender] : $this->getNsText( $index );
}
&:hover,
&:focus {
- // lessphp doesn't implement tint, see above
- // color: tint(@textColor, 20%);
- color: mix(#fff, @textColor, 20%);
+ color: @textColor;
}
&:active,
* @singleton
*/
( function ( mw, $ ) {
- var user, i,
+ var i,
deferreds = {},
- byteToHex = [],
- // Extend the skeleton mw.user from mediawiki.js
- // This is kind of ugly but we're stuck with this for b/c reasons
- options = mw.user.options || new mw.Map(),
- tokens = mw.user.tokens || new mw.Map();
+ byteToHex = [];
/**
* Get the current user's groups or rights
byteToHex[i] = ( i + 256 ).toString( 16 ).slice( 1 );
}
- mw.user = user = {
- options: options,
- tokens: tokens,
+ // mw.user with the properties options and tokens gets defined in mediawiki.js.
+ $.extend( mw.user, {
/**
* Generate a random user session ID.
*/
getRegistration: function () {
var registration = mw.config.get( 'wgUserRegistration' );
- if ( user.isAnon() ) {
+ if ( mw.user.isAnon() ) {
return false;
}
if ( registration === null ) {
* @return {boolean}
*/
isAnon: function () {
- return user.getName() === null;
+ return mw.user.getName() === null;
},
/**
sessionId: function () {
var sessionId = $.cookie( 'mediaWiki.user.sessionId' );
if ( sessionId === undefined || sessionId === null ) {
- sessionId = user.generateRandomSessionId();
+ sessionId = mw.user.generateRandomSessionId();
$.cookie( 'mediaWiki.user.sessionId', sessionId, { expires: null, path: '/' } );
}
return sessionId;
* @return {string} User name or random session ID
*/
id: function () {
- return user.getName() || user.sessionId();
+ return mw.user.getName() || mw.user.sessionId();
},
/**
getRights: function ( callback ) {
return getUserInfo( 'rights' ).done( callback );
}
- };
+ } );
}( mediaWiki, jQuery ) );