From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- .../resourceloader/ResourceLoaderUserModule.php | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'includes/resourceloader/ResourceLoaderUserModule.php') diff --git a/includes/resourceloader/ResourceLoaderUserModule.php b/includes/resourceloader/ResourceLoaderUserModule.php index 892e8462..338b6322 100644 --- a/includes/resourceloader/ResourceLoaderUserModule.php +++ b/includes/resourceloader/ResourceLoaderUserModule.php @@ -34,15 +34,30 @@ class ResourceLoaderUserModule extends ResourceLoaderWikiModule { */ protected function getPages( ResourceLoaderContext $context ) { if ( $context->getUser() ) { + // Get the normalized title of the user's user page $username = $context->getUser(); - return array( - "User:$username/common.js" => array( 'type' => 'script' ), - "User:$username/" . $context->getSkin() . '.js' => + $userpageTitle = Title::makeTitleSafe( NS_USER, $username ); + $userpage = $userpageTitle->getPrefixedDBkey(); // Needed so $excludepages works + + $pages = array( + "$userpage/common.js" => array( 'type' => 'script' ), + "$userpage/" . $context->getSkin() . '.js' => array( 'type' => 'script' ), - "User:$username/common.css" => array( 'type' => 'style' ), - "User:$username/" . $context->getSkin() . '.css' => + "$userpage/common.css" => array( 'type' => 'style' ), + "$userpage/" . $context->getSkin() . '.css' => array( 'type' => 'style' ), ); + + // Hack for bug 26283: if we're on a preview page for a CSS/JS page, + // we need to exclude that page from this module. In that case, the excludepage + // parameter will be set to the name of the page we need to exclude. + $excludepage = $context->getRequest()->getVal( 'excludepage' ); + if ( isset( $pages[$excludepage] ) ) { + // This works because $excludepage is generated with getPrefixedDBkey(), + // just like the keys in $pages[] above + unset( $pages[$excludepage] ); + } + return $pages; } return array(); } -- cgit v1.2.3-54-g00ecf