Last modified: 2014-02-15 13:22:02 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T63166, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61166 - WikiPage::newFromId( $id=0 ) needlessly queries the database
WikiPage::newFromId( $id=0 ) needlessly queries the database
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.23.0
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: performance
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-11 05:46 UTC by spage
Modified: 2014-02-15 13:22 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description spage 2014-02-11 05:46:24 UTC
WikiPage::newFromID( 0 ) actually queries the 'page' DB table to look up article ID 0. But MW code assumes that page_id == 0 means the page does not exist, e.g. Title sets mArticleId to 0 if article not found. So newFromID() could return null early if ( $id == 0 ).

One caller of this is ApiBase::getTitleOrPageId() , as a result API clients that pass pageid=0 hit the database, some even querying 'fromdbmaster'.  AFTv5 is one example (bug 61164).
Comment 1 Gerrit Notification Bot 2014-02-11 05:53:15 UTC
Change 112641 had a related patch set uploaded by Chad:
Return early when page id is less than 1

https://gerrit.wikimedia.org/r/112641
Comment 2 db [inactive,noenotif] 2014-02-15 13:22:02 UTC
Status Merged

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links