From 9b12743581c8868f7033f0b445855f84386fe5e0 Mon Sep 17 00:00:00 2001 From: Hydriz Date: Mon, 12 Nov 2012 11:28:43 +0800 Subject: [PATCH] Manual revert 6a1986449f277314700e59665987dd22740225ed. --- SpecialHostStats.php | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/SpecialHostStats.php b/SpecialHostStats.php index f07efc1..7406b0b 100644 --- a/SpecialHostStats.php +++ b/SpecialHostStats.php @@ -7,8 +7,6 @@ */ class SpecialHostStats extends SpecialPage { - protected $cmdwhitelist; - public function __construct() { parent::__construct( 'HostStats' ); } @@ -16,23 +14,10 @@ public function __construct() { public function execute( $par ) { global $wgHostStatsCommands; $this->setHeaders(); - $this->whitelistedcmds(); - $commands = array(); - foreach ( $wgHostStatsCommands as $cmd ) { - if ( in_array( $cmd, $this->cmdwhitelist ) ) { - array_push( $cmd, $commands ); - } else { - # Reject those unsafe commands and log it to hoststats - wfDebugLog( "hoststats", "Rejected running command '" . - $cmd . "' as it is unsafe, please remove it from " . - "\$wgHostStatsCommands!" ); - continue; - } - } $this->getOutput()->setPageTitle( wfMessage( 'hoststats-title' )->escaped() ); $outpage = wfMessage( 'hoststats-intro' )->escaped(); $outpage .= "\n"; - foreach ( $commands as $cmd ) { + foreach ( $wgHostStatsCommands as $cmd ) { $outpage .= '

' . $cmd . '

'; $outpage .= "\n
\n" . $this->query( $cmd ) . "
"; } @@ -43,12 +28,4 @@ protected function query( $query ) { $output = wfShellExec( $query ); return $output; } - - protected function whitelistedcmds() { - $this->cmdwhitelist = array( - 'df', - 'whoami', - 'hostname', - ); - } }