Page MenuHomePhabricator

Category information should be saved to _pageData table on FIRST save of page
Closed, ResolvedPublic

Description

This was raised on the Cargo talk page under the heading "_pageData table stores category of pages/files only after second saving of page".

Yaron noted that:

The problem is that, in order to get the category information, the code queries the "categorylinks" DB table, then stores the information in its own _pageData table. So when the page is first saved, the "categorylinks" information doesn't exist yet, so it can't be queried."

He thought the following suggestion could work:

Maybe Cargo could use a MediaWiki hook to add/remove the relevant information in the _pageData table when a page is saved. If this would slow things down it could be optional.

Maybe there is another way to do it, but it would be really useful if this could work, as I'd like to move from using DPL3 (which queries the MW categories table directly, as far as I know) to Cargo for as much as possible.

I guess I could run setCargoPageData.php every night as a cronjob in the meantime.

Event Timeline

Or maybe whenever the MediaWiki categories table gets updated in the job queue, we could use a hook to add to Cargo's _pageData table at the same time.

Yaron_Koren claimed this task.
Yaron_Koren subscribed.

This was indeed implemented in the Cargo code, using hooks, a few weeks ago in ce51277d7ed2. I'm marking this bug as "resolved", though feel free to re-open if there are any issues.