private function initFromCond($cond) { global $wgExternalSharedDB; wfDebug(__METHOD__ . ": init User from cond: " . wfArrayToString($cond) . " \n"); # PLATFORM-624: do not use slave if we just updated this user if (array_key_exists('user_id', $cond) && isset(self::$recentlyUpdated[$cond['user_id']])) { $row = null; } else { $this->mDb = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB); $row = $this->mDb->selectRow('`user`', array('*'), $cond, __METHOD__); } # PLATFORM-624: force read from master for users updated recently # note: if we had a condition for name we could still have fetched a user that # was recently updated if ($row && isset(self::$recentlyUpdated[$row->user_id])) { $row = null; } if (!$row) { $this->mDb = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB); $row = $this->mDb->selectRow('`user`', array('*'), $cond, __METHOD__); } if (!$row) { return false; } $this->mRow = $row; return true; }
private function initFromCond($cond) { global $wgExternalSharedDB; wfDebug(__METHOD__ . ": init User from cond: " . wfArrayToString($cond) . " \n"); $this->mDb = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB); $row = $this->mDb->selectRow('`user`', array('*'), $cond, __METHOD__); if (!$row) { $this->mDb = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB); $row = $this->mDb->selectRow('`user`', array('*'), $cond, __METHOD__); } if (!$row) { return false; } $this->mRow = $row; return true; }