From 14f74d141ab5580688bfd46d2f74c026e43ed967 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 1 Apr 2015 06:11:44 +0200 Subject: Update to MediaWiki 1.24.2 --- includes/specials/SpecialActiveusers.php | 8 +- includes/specials/SpecialJavaScriptTest.php | 248 +++++++++++++++++++--------- includes/specials/SpecialUserlogin.php | 13 +- 3 files changed, 184 insertions(+), 85 deletions(-) (limited to 'includes/specials') diff --git a/includes/specials/SpecialActiveusers.php b/includes/specials/SpecialActiveusers.php index ce436525..f983b452 100644 --- a/includes/specials/SpecialActiveusers.php +++ b/includes/specials/SpecialActiveusers.php @@ -115,10 +115,16 @@ class ActiveUsersPager extends UsersPager { ) . ')'; } + if ( $dbr->implicitGroupby() ) { + $options = array( 'GROUP BY' => array( 'qcc_title' ) ); + } else { + $options = array( 'GROUP BY' => array( 'user_name', 'user_id', 'qcc_title' ) ); + } + return array( 'tables' => array( 'querycachetwo', 'user', 'recentchanges' ), 'fields' => array( 'user_name', 'user_id', 'recentedits' => 'COUNT(*)', 'qcc_title' ), - 'options' => array( 'GROUP BY' => array( 'qcc_title' ) ), + 'options' => $options, 'conds' => $conds ); } diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index 0efebb3e..7d745a50 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -26,12 +26,10 @@ */ class SpecialJavaScriptTest extends SpecialPage { /** - * @var array Mapping of framework ids and their initilizer methods - * in this class. If a framework is requested but not in this array, - * the 'unknownframework' error is served. + * @var array Supported frameworks. */ private static $frameworks = array( - 'qunit' => 'initQUnitTesting', + 'qunit', ); public function __construct() { @@ -44,43 +42,70 @@ class SpecialJavaScriptTest extends SpecialPage { $this->setHeaders(); $out->disallowUserJs(); - $out->addModules( 'mediawiki.special.javaScriptTest' ); - - // Determine framework - $pars = explode( '/', $par ); - $framework = strtolower( $pars[0] ); - - // No framework specified - if ( $par == '' ) { + if ( $par === null ) { + // No framework specified + $out->setStatusCode( 404 ); $out->setPageTitle( $this->msg( 'javascripttest' ) ); - $summary = $this->wrapSummaryHtml( - $this->msg( 'javascripttest-pagetext-noframework' )->escaped() . - $this->getFrameworkListHtml(), - 'noframework' + $out->addHTML( + $this->msg( 'javascripttest-pagetext-noframework' )->parseAsBlock() + . $this->getFrameworkListHtml() ); - $out->addHtml( $summary ); - } elseif ( isset( self::$frameworks[$framework] ) ) { - // Matched! Display proper title and initialize the framework - $out->setPageTitle( $this->msg( - 'javascripttest-title', - // Messages: javascripttest-qunit-name - $this->msg( "javascripttest-$framework-name" )->plain() - ) ); - $out->setSubtitle( $this->msg( 'javascripttest-backlink' ) - ->rawParams( Linker::linkKnown( $this->getPageTitle() ) ) ); - $this->{self::$frameworks[$framework]}(); - } else { - // Framework not found, display error - $out->setPageTitle( $this->msg( 'javascripttest' ) ); - $summary = $this->wrapSummaryHtml( - '

' . - $this->msg( 'javascripttest-pagetext-unknownframework', $par )->escaped() . - '

' . - $this->getFrameworkListHtml(), - 'unknownframework' + return; + } + + // Determine framework and mode + $pars = explode( '/', $par, 2 ); + + $framework = $pars[0]; + if ( !in_array( $framework, self::$frameworks ) ) { + // Framework not found + $out->setStatusCode( 404 ); + $out->addHTML( + '
' + . $this->msg( 'javascripttest-pagetext-unknownframework' ) + ->plaintextParams( $par )->parseAsBlock() + . '
' + . $this->getFrameworkListHtml() ); - $out->addHtml( $summary ); + return; } + + // This special page is disabled by default ($wgEnableJavaScriptTest), and contains + // no sensitive data. In order to allow TestSwarm to embed it into a test client window, + // we need to allow iframing of this page. + $out->allowClickjacking(); + $out->setSubtitle( + $this->msg( 'javascripttest-backlink' ) + ->rawParams( Linker::linkKnown( $this->getPageTitle() ) ) + ); + + // Custom actions + if ( isset( $pars[1] ) ) { + $action = $pars[1]; + if ( !in_array( $action, array( 'export', 'plain' ) ) ) { + $out->setStatusCode( 404 ); + $out->addHTML( + '
' + . $this->msg( 'javascripttest-pagetext-unknownaction' ) + ->plaintextParams( $action )->parseAsBlock() + . '
' + ); + return; + } + $method = $action . ucfirst( $framework ); + $this->$method(); + return; + } + + $out->addModules( 'mediawiki.special.javaScriptTest' ); + + $method = 'view' . ucfirst( $framework ); + $this->$method(); + $out->setPageTitle( $this->msg( + 'javascripttest-title', + // Messages: javascripttest-qunit-name + $this->msg( "javascripttest-$framework-name" )->plain() + ) ); } /** @@ -91,7 +116,7 @@ class SpecialJavaScriptTest extends SpecialPage { */ private function getFrameworkListHtml() { $list = '