/** * Given a set of conditions, fetch a revision. * * @param array $conditions * @return Revision * @static * @access private */ static function newFromConds($conditions) { $db =& wfGetDB(DB_SLAVE); $row = Revision::loadFromConds($db, $conditions); if (is_null($row)) { $dbw =& wfGetDB(DB_MASTER); $row = Revision::loadFromConds($dbw, $conditions); } return $row; }
/** * Given a set of conditions, fetch a revision. * * @param array $conditions * @return Revision * @access private * @static */ private static function newFromConds($conditions) { $db = wfGetDB(DB_SLAVE); $row = Revision::loadFromConds($db, $conditions); if (is_null($row) && wfGetLB()->getServerCount() > 1) { $dbw = wfGetDB(DB_MASTER); $row = Revision::loadFromConds($dbw, $conditions); } return $row; }
/** * Given a set of conditions, fetch a revision. * * @param array $conditions * @param bool $useMaster * * @return Revision|null */ public static function newFromConds($conditions, $useMaster = false) { $dbType = $useMaster ? DB_MASTER : DB_SLAVE; $db = wfGetDB($dbType); $rev = Revision::loadFromConds($db, $conditions); if (is_null($rev) && wfGetLB()->getServerCount() > 1) { $dbw = wfGetDB(DB_MASTER); $rev = Revision::loadFromConds($dbw, $conditions); } return $rev; }