Improve namespaceDupes.php
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index 2f8b7d2..af14bb3 100644 (file)
@@ -604,7 +604,7 @@ abstract class Maintenance {
                global $wgProfiler;
 
                $output = $this->getOption( 'profiler' );
-               if ( $output && is_array( $wgProfiler ) ) {
+               if ( $output && is_array( $wgProfiler ) && isset( $wgProfiler['class'] ) ) {
                        $class = $wgProfiler['class'];
                        $profiler = new $class(
                                array( 'sampling' => 1, 'output' => $output ) + $wgProfiler
@@ -1073,7 +1073,7 @@ abstract class Maintenance {
         *
         * @return DatabaseBase
         */
-       protected function &getDB( $db, $groups = array(), $wiki = false ) {
+       protected function getDB( $db, $groups = array(), $wiki = false ) {
                if ( is_null( $this->mDb ) ) {
                        return wfGetDB( $db, $groups, $wiki );
                } else {
@@ -1086,7 +1086,7 @@ abstract class Maintenance {
         *
         * @param DatabaseBase $db Database object to be used
         */
-       public function setDB( &$db ) {
+       public function setDB( $db ) {
                $this->mDb = $db;
        }
 
@@ -1094,7 +1094,7 @@ abstract class Maintenance {
         * Lock the search index
         * @param DatabaseBase &$db
         */
-       private function lockSearchindex( &$db ) {
+       private function lockSearchindex( $db ) {
                $write = array( 'searchindex' );
                $read = array( 'page', 'revision', 'text', 'interwiki', 'l10n_cache', 'user' );
                $db->lockTables( $read, $write, __CLASS__ . '::' . __METHOD__ );
@@ -1104,7 +1104,7 @@ abstract class Maintenance {
         * Unlock the tables
         * @param DatabaseBase &$db
         */
-       private function unlockSearchindex( &$db ) {
+       private function unlockSearchindex( $db ) {
                $db->unlockTables( __CLASS__ . '::' . __METHOD__ );
        }
 
@@ -1113,7 +1113,7 @@ abstract class Maintenance {
         * Since the lock is low-priority, queued reads will be able to complete
         * @param DatabaseBase &$db
         */
-       private function relockSearchindex( &$db ) {
+       private function relockSearchindex( $db ) {
                $this->unlockSearchindex( $db );
                $this->lockSearchindex( $db );
        }
@@ -1207,7 +1207,13 @@ abstract class Maintenance {
                }
 
                if ( $isatty && function_exists( 'readline' ) ) {
-                       return readline( $prompt );
+                       $resp = readline( $prompt );
+                       if ( $resp === null ) {
+                               // Workaround for https://github.com/facebook/hhvm/issues/4776
+                               return false;
+                       } else {
+                               return $resp;
+                       }
                } else {
                        if ( $isatty ) {
                                $st = self::readlineEmulation( $prompt );