summaryrefslogtreecommitdiff
path: root/maintenance/eval.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/eval.php')
-rw-r--r--maintenance/eval.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/maintenance/eval.php b/maintenance/eval.php
index a990a4d8..3cc1d16a 100644
--- a/maintenance/eval.php
+++ b/maintenance/eval.php
@@ -16,7 +16,7 @@
* @ingroup Maintenance
*/
-$wgUseNormalUser = (bool)getenv('MW_WIKIUSER');
+$wgUseNormalUser = (bool)getenv( 'MW_WIKIUSER' );
$optionsWithArgs = array( 'd' );
@@ -39,8 +39,8 @@ if ( isset( $options['d'] ) ) {
}
}
-if ( function_exists( 'readline_add_history' )
- && function_exists( 'posix_isatty' ) && posix_isatty( 0 /*STDIN*/ ) )
+if ( function_exists( 'readline_add_history' )
+ && posix_isatty( 0 /*STDIN*/ ) )
{
$useReadline = true;
} else {
@@ -48,19 +48,20 @@ if ( function_exists( 'readline_add_history' )
}
if ( $useReadline ) {
- $historyFile = "{$_ENV['HOME']}/.mweval_history";
+ $historyFile = isset( $_ENV['HOME'] ) ?
+ "{$_ENV['HOME']}/.mweval_history" : "$IP/maintenance/.mweval_history";
readline_read_history( $historyFile );
}
-while ( ( $line = readconsole( '> ' ) ) !== false ) {
+while ( ( $line = Maintenance::readconsole() ) !== false ) {
if ( $useReadline ) {
readline_add_history( $line );
readline_write_history( $historyFile );
}
$val = eval( $line . ";" );
- if( is_null( $val ) ) {
+ if ( is_null( $val ) ) {
echo "\n";
- } elseif( is_string( $val ) || is_numeric( $val ) ) {
+ } elseif ( is_string( $val ) || is_numeric( $val ) ) {
echo "$val\n";
} else {
var_dump( $val );