Return early when page id is less than 1
Wasteful DB query when we know the page won't exist. Bug: 61166 Change-Id: I8943b4dec5088dadffefbd74f54653cb09043b7c
This commit is contained in:
parent
f1a1cd5d79
commit
d7f465f7e8
1 changed files with 5 additions and 0 deletions
|
|
@ -142,6 +142,11 @@ class WikiPage implements Page, IDBAccessObject {
|
|||
* @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__ );
|
||||
|
|
|
|||
Loading…
Reference in a new issue