Make ApiQueryBase::addTitleInfo optionally able to add the page id
Open, NormalPublic

Description

Make ApiQueryBase::addTitleInfo optionally able to add the page id

But not by doing an unconditional db query (make the input get it first), as that'd be rather nasty...


Version: 1.20.x
Severity: enhancement

Details

Reference
bz28901
bzimport raised the priority of this task from to Normal.
bzimport set Reference to bz28901.
Reedy created this task.May 9 2011, 8:40 PM

Bryan.TongMinh wrote:

Is there a way to store the page id in the Title object?

(In reply to comment #1)

Is there a way to store the page id in the Title object?

Looks like $mArticleID (set by Title::newFromRow)

Bryan.TongMinh wrote:

Ok, so that is easy.

We should first check though if all usages of addTitleInfo() use a Title that was constructed with a row that contains page_id so as to avoid running a new query for every title.

Reedy added a comment.May 14 2011, 9:06 AM

Indeed. May have to change things to use a faux Row object to get the information, but whatever

I was going to do that as part of the cleanup, at worst, in most cases, it'll be just pulling an extra column out of the database if it's not already done

Bryan.TongMinh wrote:

ApiImport is good
ApiPatrol is good
ApiPurge is not good, and is presumably already doing a query for every title because it is doing (new Title)->exists() in a loop.
ApiQuery gets its titles from ApiPageSet; need to check that.
ApiQueryAllimages is not good
ApiQueryAlllinks is not good
ApiQueryBacklinks is not good
... and many others are not good either. So somebody should take some time to fix all of them.

I'm assuming that all those not good ones need similar fixes, right? Would it be possible to do one and point to it here as documentation so I can add this bug to [[mw:Annoying Little Bug]]?

Ugh, that is a page on Mediawiki.org

Reedy added a comment.May 20 2011, 5:15 PM

(In reply to comment #5)

ApiQuery gets its titles from ApiPageSet; need to check that.

		$pageFlds = array(
			'page_namespace' => null,
			'page_title' => null,
			'page_id' => null,
		);

Looks good to me

brion added a comment.Dec 20 2011, 9:21 PM

Reverted r106523 in r106862; this is a strange abstraction violation and looks pretty weird to me.

Jdforrester-WMF removed Catrope as the assignee of this task.Apr 17 2015, 5:54 PM