From: Chad Horohoe Date: Tue, 28 Sep 2010 11:39:10 +0000 (+0000) Subject: Sanity check on result from SHOW PROCESSLIST, foreach -> while (sorta followup to... X-Git-Tag: 1.31.0-rc.0~34764 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=57aee600f759feefcf067c630fc19b7304396f4c;p=lhc%2Fweb%2Fwiklou.git Sanity check on result from SHOW PROCESSLIST, foreach -> while (sorta followup to r68878) --- diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index afcaa2cd44..041ebd16d3 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -321,8 +321,11 @@ class DatabaseMysql extends DatabaseBase { return $this->mFakeSlaveLag; } $res = $this->query( 'SHOW PROCESSLIST', __METHOD__ ); + if( !$res ) { + return false; + } # Find slave SQL thread - while ( $row = $this->fetchObject( $res ) ) { + foreach( $res as $row ) { /* This should work for most situations - when default db * for thread is not specified, it had no events executed, * and therefore it doesn't know yet how lagged it is.