Merge "Revert "Temporarily trim leading/trailing whitespace from parser test clauses""
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index c786ce8..b638b42 100644 (file)
@@ -23,7 +23,7 @@
 // Bail on old versions of PHP, or if composer has not been run yet to install
 // dependencies.
 require_once __DIR__ . '/../includes/PHPVersionCheck.php';
-wfEntryPointCheck( 'cli' );
+wfEntryPointCheck( 'text' );
 
 use MediaWiki\Shell\Shell;
 
@@ -1251,7 +1251,7 @@ abstract class Maintenance {
                        $settingsFile = "$IP/LocalSettings.php";
                }
                if ( isset( $this->mOptions['wiki'] ) ) {
-                       $bits = explode( '-', $this->mOptions['wiki'] );
+                       $bits = explode( '-', $this->mOptions['wiki'], 2 );
                        if ( count( $bits ) == 1 ) {
                                $bits[] = '';
                        }
@@ -1326,7 +1326,6 @@ abstract class Maintenance {
                        $this->output( "done.\n" );
                }
 
-               # Done
                $this->commitTransaction( $dbw, __METHOD__ );
        }
 
@@ -1349,11 +1348,10 @@ abstract class Maintenance {
         * @return IMaintainableDatabase
         */
        protected function getDB( $db, $groups = [], $wiki = false ) {
-               if ( is_null( $this->mDb ) ) {
+               if ( $this->mDb === null ) {
                        return wfGetDB( $db, $groups, $wiki );
-               } else {
-                       return $this->mDb;
                }
+               return $this->mDb;
        }
 
        /**