Merge "resourceloader: Implement '$pages' parameter to ResourceLoaderWikiModule const...
[lhc/web/wiklou.git] / maintenance / Maintenance.php
index 4b07d2f..a0ffcb2 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
@@ -696,6 +696,9 @@ abstract class Maintenance {
                                        }
                                        $options[$option] = $param;
                                }
+                       } elseif ( $arg == '-' ) {
+                               # Lonely "-", often used to indicate stdin or stdout.
+                               $args[] = $arg;
                        } elseif ( substr( $arg, 0, 1 ) == '-' ) {
                                # Short options
                                $argLength = strlen( $arg );
@@ -1207,7 +1210,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 );