Merge "Get rid of unnecessary func_get_args() and friends"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 12 Apr 2019 20:36:15 +0000 (20:36 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 12 Apr 2019 20:36:15 +0000 (20:36 +0000)
includes/dao/DBAccessBase.php
includes/htmlform/fields/HTMLFormFieldWithButton.php
includes/htmlform/fields/HTMLTextField.php
maintenance/Maintenance.php

index 8900962..e099b38 100644 (file)
@@ -2,7 +2,7 @@
 
 use MediaWiki\MediaWikiServices;
 use Wikimedia\Rdbms\IDatabase;
-use Wikimedia\Rdbms\LoadBalancer;
+use Wikimedia\Rdbms\ILoadBalancer;
 
 /**
  * Base class for objects that allow access to other wiki's databases using
@@ -88,7 +88,7 @@ abstract class DBAccessBase implements IDBAccessObject {
         *
         * @since 1.21
         *
-        * @return LoadBalancer The database load balancer object
+        * @return ILoadBalancer The database load balancer object
         */
        public function getLoadBalancer() {
                $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
index 03e479b..93f5363 100644 (file)
@@ -59,6 +59,7 @@ class HTMLFormFieldWithButton extends HTMLFormField {
                        'type' => $this->mButtonType,
                        'label' => $this->mButtonValue,
                        'flags' => $this->mButtonFlags,
+                       'id' => $this->mButtonId,
                ] + OOUI\Element::configFromHtmlAttributes(
                        $this->getAttributes( [ 'disabled', 'tabindex' ] )
                ) );
index 60c63d6..56589b0 100644 (file)
@@ -131,6 +131,9 @@ class HTMLTextField extends HTMLFormField {
                                case 'url':
                                        $type = $this->mParams['type'];
                                        break;
+                               case 'textwithbutton':
+                                       $type = $this->mParams['inputtype'] ?? 'text';
+                                       break;
                        }
                }
 
index 1cca26e..c88a1a0 100644 (file)
@@ -42,6 +42,13 @@ define( 'DO_MAINTENANCE', RUN_MAINTENANCE_IF_MAIN ); // original name, harmless
 
 $maintClass = false;
 
+// Some extensions rely on MW_INSTALL_PATH to find core files to include. Setting it here helps them
+// if they're included by a core script (like DatabaseUpdater) after Maintenance.php has already
+// been run.
+if ( strval( getenv( 'MW_INSTALL_PATH' ) ) === '' ) {
+       putenv( 'MW_INSTALL_PATH=' . realpath( __DIR__ . '/..' ) );
+}
+
 use Wikimedia\Rdbms\IDatabase;
 use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
@@ -171,11 +178,8 @@ abstract class Maintenance {
         * their own constructors
         */
        public function __construct() {
-               // Setup $IP, using MW_INSTALL_PATH if it exists
                global $IP;
-               $IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== ''
-                       ? getenv( 'MW_INSTALL_PATH' )
-                       : realpath( __DIR__ . '/..' );
+               $IP = getenv( 'MW_INSTALL_PATH' );
 
                $this->addDefaultParams();
                register_shutdown_function( [ $this, 'outputChanneled' ], false );