# If errors are explicitly ignored, returns success
function wfQuery( $sql, $db, $fname = "" )
{
+ global $wgOut;
if ( !is_numeric( $db ) ) {
# Someone has tried to call this the old way
$wgOut->fatalError( wfMsgNoDB( "wrong_wfQuery_params", $db, $sql ) );
foreach ( $weights as $w ) {
$sum += $w;
}
- $rand = mt_rand() / RAND_MAX * $sum;
+ $max = mt_getrandmax();
+ $rand = mt_rand(0, $max) / $max * $sum;
$sum = 0;
foreach ( $weights as $i => $w ) {
# don't work
$loads = $this->mLoads;
do {
- $i = pickRandom( $loads );
+ $i = $this->pickRandom( $loads );
if ( $i !== false ) {
+ wfDebug( "Using reader #$i: {$this->mServers[$i]}\n" );
+
$conn =& $this->getConnection( $i );
if ( !$conn->isOpen() ) {
unset( $loads[$i] );