Page MenuHomePhabricator

Cargo _categories field of PageData not getting updated after page edit
Closed, ResolvedPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Make sure LocalSettings.php contains $wgCargoPageDataColumns[] = 'categories';
  • Make sure page X belongs to at least one category (e.g. [[Category:Y]])
  • Edit page X and save it
  • Check Page Values (index.php?title=X&action=pagevalues)

What happens?:

  • _categories field remains empty

What should have happened instead?:

  • _categories contains categories, e.g. "Y"

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

  • MW 1.39.3 (283beed)
  • Cargo 3.4.2

Other information (browser name/version, screenshots, etc.):

When I set the switch in this line from false to true, the categories field gets populated correctly.

It's not clear to me in which case this should be false?

Event Timeline

That's a somewhat old version of Cargo, and I think the handling of page data has changed since then. Could you try upgrading to the latest version?

I updated to v3.6.1 now, but still the page categories remain blank after a page edit. When I change this line to "true" instead of "false", it works as expected.

Okay, thanks for trying the update. I have two questions: does the category that you set the page to actually exist, i.e. has a blue link to it? And if you go to Special:CargoTables, does a replacement table row appear for _pageData?

Yes, all categories exist, and no replacement table row appears for _pageData on Special:CargoTables.

That's strange, then - those were my two guesses about what was going wrong. So, I have no idea. I'm glad you found a fix for it, but that particular code change should not be necessary. (And it's not necessary on my wiki.) Barring any further information, I don't know how to proceed on this one. Maybe someone else has some idea...

Change #1249038 had a related patch set uploaded (by TechieNK; author: TechieNK):

[mediawiki/extensions/Cargo@master] Fix missing _categories field data on page save

https://gerrit.wikimedia.org/r/1249038

I have applied this patch to my wiki and, for the first time ever, categorisation works on my wiki! It seems just to be to remove , false from CargoPageData::storeValuesForPage( $title, $useReplacementTable, false );

I have mentioned the problem on the talk page, most recently here: https://www.mediawiki.org/wiki/Extension_talk:Cargo#Storage_of_categories_is_unreliable. It used to be that the following described what happened:

  1. - Add categories X and Y.
  2. - Cargo immediately knows these categories.
  3. - Any edit (including null edit) makes Cargo forget all categories.
  4. - Add category Z, in addition to X and Y, in the wikitext.
  5. - Cargo immediately knows Z (but only Z, i.e. not X or Y).
  6. - The above can be repeated (i.e. Cargo forgetting on edit, and only registering newly added categories).

Now at step 3 Cargo doesn't forget the categories, and at step 5 Cargo knows that the page is in categories X, Y and Z. (By "know" I just mean that it appears on the action=pagevalues page).

MW 1.43.6, Cargo 3.8.6.

P.S. I've removed the patch for now as I don't understand it and for all I know it'll break something else :-)

@Jonathan3 - it's great to hear that this patch works for you!

Change #1249038 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] Fix missing _categories field data on page save

https://gerrit.wikimedia.org/r/1249038

Yaron_Koren added a subscriber: TechieNK.

I assume this can be closed now, thanks to @TechieNK 's fix. Feel free to re-open if it's still an issue.