Merge "Replace DatabaseBase:: with Database:: and update type hints"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 27 Sep 2016 04:31:06 +0000 (04:31 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 27 Sep 2016 04:31:06 +0000 (04:31 +0000)
25 files changed:
includes/EditPage.php
includes/MovePage.php
includes/api/ApiAuthManagerHelper.php
includes/api/ApiCSPReport.php
includes/api/ApiQuerySearch.php
includes/auth/ButtonAuthenticationRequest.php
includes/auth/PasswordDomainAuthenticationRequest.php
includes/auth/ResetPasswordSecondaryAuthenticationProvider.php
includes/auth/TemporaryPasswordPrimaryAuthenticationProvider.php
includes/content/WikiTextStructure.php
includes/context/ContextSource.php
includes/db/DatabaseMssql.php
includes/exception/MWExceptionRenderer.php
includes/libs/virtualrest/VirtualRESTServiceClient.php
includes/logging/LogEventsList.php
includes/media/Bitmap.php
includes/parser/Parser.php
includes/specialpage/AuthManagerSpecialPage.php
includes/specials/SpecialPreferences.php
includes/specials/SpecialRandomInCategory.php
includes/specials/SpecialUserrights.php
includes/tidy/Balancer.php
maintenance/cleanupEmptyCategories.php
maintenance/initEditCount.php
maintenance/rebuildFileCache.php

index 406673d..f449283 100644 (file)
@@ -3496,7 +3496,7 @@ HTML
         * @param string $format Output format, valid values are any function of a Message object
         * @return string
         */
-       public static function getCopyrightWarning( $title, $format = 'plain' ) {
+       public static function getCopyrightWarning( $title, $format = 'plain', $langcode = null ) {
                global $wgRightsText;
                if ( $wgRightsText ) {
                        $copywarnMsg = [ 'copyrightwarning',
@@ -3509,8 +3509,12 @@ HTML
                // Allow for site and per-namespace customization of contribution/copyright notice.
                Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] );
 
+               $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title );
+               if ( $langcode ) {
+                       $msg->inLanguage( $langcode );
+               }
                return "<div id=\"editpage-copywarn\">\n" .
-                       call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n</div>";
+                       $msg->$format() . "\n</div>";
        }
 
        /**
@@ -4263,7 +4267,7 @@ HTML
        protected function safeUnicodeOutput( $text ) {
                return $this->checkUnicodeCompliantBrowser()
                        ? $text
-                       : $this->makesafe( $text );
+                       : $this->makeSafe( $text );
        }
 
        /**
index d17f234..5f1dd3f 100644 (file)
@@ -446,7 +446,7 @@ class MovePage {
                        $status = $newpage->doDeleteArticleReal(
                                $overwriteMessage,
                                /* $suppress */ false,
-                               $nt->getArticleId(),
+                               $nt->getArticleID(),
                                /* $commit */ false,
                                $errs,
                                $user
index 8e57f93..1a42ccc 100644 (file)
@@ -191,8 +191,6 @@ class ApiAuthManagerHelper {
         * @return array
         */
        public function formatAuthenticationResponse( AuthenticationResponse $res ) {
-               $params = $this->module->extractRequestParams();
-
                $ret = [
                        'status' => $res->status,
                ];
index 407ae71..5a0edfc 100644 (file)
@@ -85,7 +85,6 @@ class ApiCSPReport extends ApiBase {
         */
        private function getFlags( $report ) {
                $reportOnly = $this->getParameter( 'reportonly' );
-               $userAgent = $this->getRequest()->getHeader( 'user-agent' );
                $source = $this->getParameter( 'source' );
                $falsePositives = $this->getConfig()->get( 'CSPFalsePositiveUrls' );
 
index f46b5d2..ba60da9 100644 (file)
@@ -24,8 +24,6 @@
  * @file
  */
 
-use MediaWiki\MediaWikiServices;
-
 /**
  * Query module to perform full text search within wiki titles and content
  *
@@ -235,7 +233,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
                                                $vals = [
                                                        'namespace' => $result->getInterwikiNamespaceText(),
                                                        'title' => $title->getText(),
-                                                       'url' => $title->getFullUrl(),
+                                                       'url' => $title->getFullURL(),
                                                ];
 
                                                // Add item to results and see whether it fits
index 055d7ea..d274e18 100644 (file)
@@ -81,6 +81,8 @@ class ButtonAuthenticationRequest extends AuthenticationRequest {
 
        /**
         * @codeCoverageIgnore
+        * @param array $data
+        * @return AuthenticationRequest|static
         */
        public static function __set_state( $data ) {
                if ( !isset( $data['label'] ) ) {
index ddad54b..3db7e21 100644 (file)
@@ -70,6 +70,8 @@ class PasswordDomainAuthenticationRequest extends PasswordAuthenticationRequest
 
        /**
         * @codeCoverageIgnore
+        * @param array $data
+        * @return AuthenticationRequest|static
         */
        public static function __set_state( $data ) {
                $ret = new static( $data['domainList'] );
index f11a12c..45ac3aa 100644 (file)
@@ -58,6 +58,7 @@ class ResetPasswordSecondaryAuthenticationProvider extends AbstractSecondaryAuth
 
        /**
         * Try to reset the password
+        * @param \User $user
         * @param AuthenticationRequest[] $reqs
         * @return AuthenticationResponse
         */
index f16423d..9962fa3 100644 (file)
@@ -140,7 +140,7 @@ class TemporaryPasswordPrimaryAuthenticationProvider
                }
 
                $status = $this->checkPasswordValidity( $username, $req->password );
-               if ( !$status->isOk() ) {
+               if ( !$status->isOK() ) {
                        // Fatal, can't log in
                        return AuthenticationResponse::newFail( $status->getMessage() );
                }
index 55c4ad5..fe12ff7 100644 (file)
@@ -1,7 +1,6 @@
 <?php
 
 use HtmlFormatter\HtmlFormatter;
-use MediaWiki\Logger\LoggerFactory;
 
 /**
  * Class allowing to explore structure of parsed wikitext.
index b617871..829dd73 100644 (file)
@@ -19,7 +19,6 @@
  * @file
  */
 use Liuggio\StatsdClient\Factory\StatsdDataFactory;
-use MediaWiki\MediaWikiServices;
 
 /**
  * The simplest way of implementing IContextSource is to hold a RequestContext as a
index 45ea54c..6d07216 100644 (file)
@@ -771,7 +771,7 @@ class DatabaseMssql extends DatabaseBase {
 
                $this->mScrollableCursor = false;
                try {
-                       $ret = $this->query( $sql );
+                       $this->query( $sql );
                } catch ( Exception $e ) {
                        $this->mScrollableCursor = true;
                        throw $e;
index e242da3..aba131d 100644 (file)
@@ -172,7 +172,7 @@ class MWExceptionRenderer {
                        } else {
                                // Show any custom GUI message before the details
                                if ( $e instanceof MessageSpecifier ) {
-                                       $wgOut->addHtml( Message::newFromSpecifier( $e )->escaped() );
+                                       $wgOut->addHTML( Message::newFromSpecifier( $e )->escaped() );
                                }
                                $wgOut->addHTML( self::getHTML( $e ) );
                        }
index 0864e5c..1b7545a 100644 (file)
@@ -304,7 +304,7 @@ class VirtualRESTServiceClient {
         */
        private function getInstance( $prefix ) {
                if ( !isset( $this->instances[$prefix] ) ) {
-                       throw new RunTimeException( "No service registered at prefix '{$prefix}'." );
+                       throw new RuntimeException( "No service registered at prefix '{$prefix}'." );
                }
 
                if ( !( $this->instances[$prefix] instanceof VirtualRESTService ) ) {
index f29c9e4..0cf584b 100644 (file)
@@ -310,7 +310,7 @@ class LogEventsList extends ContextSource {
                        return '';
                }
                $html = '';
-               $html .= xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
+               $html .= Xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
                        'action-filter-' .$types[0] ) . "\n";
                $select = new XmlSelect( 'subtype' );
                $select->addOption( wfMessage( 'log-action-filter-all' )->text(), '' );
@@ -319,7 +319,7 @@ class LogEventsList extends ContextSource {
                        $select->addOption( wfMessage( $msgKey )->text(), $value );
                }
                $select->setDefault( $action );
-               $html .= $select->getHtml();
+               $html .= $select->getHTML();
                return $html;
        }
 
index ccd345c..c86eabd 100644 (file)
@@ -276,7 +276,7 @@ class BitmapHandler extends TransformationalImageHandler {
         */
        protected function transformImageMagickExt( $image, $params ) {
                global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
-                       $wgMaxInterlacingAreas, $wgJpegPixelFormat;
+                       $wgJpegPixelFormat;
 
                try {
                        $im = new Imagick();
index 7c18798..590d51e 100644 (file)
@@ -251,7 +251,7 @@ class Parser {
        protected $mProfiler;
 
        /**
-        * @var \MediaWiki\Linker\LinkRenderer
+        * @var LinkRenderer
         */
        protected $mLinkRenderer;
 
@@ -887,10 +887,10 @@ class Parser {
        }
 
        /**
-        * Get a \MediaWiki\Linker\LinkRenderer instance to make links with
+        * Get a LinkRenderer instance to make links with
         *
         * @since 1.28
-        * @return \MediaWiki\Linker\LinkRenderer
+        * @return LinkRenderer
         */
        public function getLinkRenderer() {
                if ( !$this->mLinkRenderer ) {
index 3adf5a6..bdf7638 100644 (file)
@@ -43,7 +43,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
         * Change the form descriptor that determines how a field will look in the authentication form.
         * Called from fieldInfoToFormDescriptor().
         * @param AuthenticationRequest[] $requests
-        * @param string $fieldInfo Field information array (union of all
+        * @param array $fieldInfo Field information array (union of all
         *    AuthenticationRequest::getFieldInfo() responses).
         * @param array $formDescriptor HTMLForm descriptor. The special key 'weight' can be set to
         *    change the order of the fields.
@@ -205,6 +205,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
        /**
         * Return custom message key.
         * Allows subclasses to customize messages.
+        * @param string $defaultKey
         * @return string
         */
        protected function messageKey( $defaultKey ) {
@@ -668,6 +669,7 @@ abstract class AuthManagerSpecialPage extends SpecialPage {
         * Maps an authentication field configuration for a single field (as returned by
         * AuthenticationRequest::getFieldInfo()) to a HTMLForm field descriptor.
         * @param array $singleFieldInfo
+        * @param string $fieldName
         * @return array
         */
        protected static function mapSingleFieldInfo( $singleFieldInfo, $fieldName ) {
index 3697e5d..eee5b64 100644 (file)
@@ -59,7 +59,7 @@ class SpecialPreferences extends SpecialPage {
                        $session->remove( 'specialPreferencesSaveSuccess' );
                        $out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' );
 
-                       $out->addHtml(
+                       $out->addHTML(
                                Html::rawElement(
                                        'div',
                                        [
index fc924a4..adf12d4 100644 (file)
@@ -272,7 +272,7 @@ class SpecialRandomInCategory extends FormSpecialPage {
                                'high' => 'MAX( cl_timestamp )'
                        ],
                        [
-                               'cl_to' => $this->category->getDBKey(),
+                               'cl_to' => $this->category->getDBkey(),
                        ],
                        __METHOD__,
                        [
index 8a06abf..433dcab 100644 (file)
@@ -156,7 +156,7 @@ class UserrightsPage extends SpecialPage {
                if ( $request->getCheck( 'success' ) && $this->mFetchedUser !== null ) {
                        $out->addModules( [ 'mediawiki.special.userrights' ] );
                        $out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' );
-                       $out->addHtml(
+                       $out->addHTML(
                                Html::rawElement(
                                        'div',
                                        [
index 666f3f9..069b460 100644 (file)
@@ -729,7 +729,7 @@ class BalanceStack implements IteratorAggregate {
                        $this->config['tidyCompat'] && !$isComment &&
                        $this->currentNode->isA( BalanceSets::$tidyPWrapSet )
                ) {
-                       $this->insertHTMLELement( 'mw:p-wrap', [] );
+                       $this->insertHTMLElement( 'mw:p-wrap', [] );
                        return $this->insertText( $value );
                } else {
                        $this->currentNode->appendChild( $value );
index b8a246e..8672223 100644 (file)
@@ -147,7 +147,6 @@ TEXT
                        } else {
                                $where = [];
                        }
-                       $i = 0;
 
                        $this->output( "Removing empty categories without description pages...\n" );
                        while ( true ) {
index 6b06da7..96aea03 100644 (file)
@@ -42,8 +42,6 @@ in the load balancer, usually indicating a replication environment.' );
                $user = $dbw->tableName( 'user' );
                $revision = $dbw->tableName( 'revision' );
 
-               $dbver = $dbw->getServerVersion();
-
                // Autodetect mode...
                if ( $this->hasOption( 'background' ) ) {
                        $backgroundMode = true;
index 2287559..da8a6bc 100644 (file)
@@ -96,7 +96,6 @@ class RebuildFileCache extends Maintenance {
                $blockEnd = $start + $this->mBatchSize - 1;
 
                $dbw = $this->getDB( DB_MASTER );
-               $mainContext = RequestContext::getMain();
                // Go through each page and save the output
                while ( $blockEnd <= $end ) {
                        // Get the pages