Wasteful DB query when we know the page won't exist.
Bug: 61166
Change-Id: I8943b4dec5088dadffefbd74f54653cb09043b7c
* @return WikiPage|null
*/
public static function newFromID( $id, $from = 'fromdb' ) {
+ // page id's are never 0 or negative, see bug 61166
+ if ( $id < 1 ) {
+ return;
+ }
+
$from = self::convertSelectType( $from );
$db = wfGetDB( $from === self::READ_LATEST ? DB_MASTER : DB_SLAVE );
$row = $db->selectRow( 'page', self::selectFields(), array( 'page_id' => $id ), __METHOD__ );