Page MenuHomePhabricator

cargoRecreateData line 150 getcontent() on null
Closed, ResolvedPublic

Description

I'm in the process of transferring my wiki from smw to cargo.

For the last little while whenever I run php extensions/Cargo/maintenance/cargoRecreateData.php once it gets to a specific table it errors out with Error from line 150 of extensions/Cargo/maintenance/cargoRecreateData.php: Call to member function getContent() on null.

To get around this, I edited the file to add a

if ($wikiPage === null) {
  continue;
}

before the to getContent().

It's weird because even before I put in this fix, I could run the script with --table on the table that failed with no problems.

Event Timeline

I started trying to debug where my bad data is coming from, by inserting echo statements.

While this will let me fix my data, I still think hardening the cargoRecreateData against bad data is a good idea, as I can't trace exactly how I got bad data in the first place.

the problem only happens if I run the script without --table, if I target the table in particular it works fine.

$title->getArticleID(): 0
$title->mDbkeyform: CustomArchivalNamespace:ArchivedPage15 (placeholders)
$title->mNamespace: 0
So it is a legit page in the wiki. The only thing populated in the $title structure are mTextform, mUrlform, mDbkeyform, mNamespace (0), mArticleID (0), mDefaultNamespace (0), mLength:protected (-1).

So based on the namespace in the $title array, and the fact it has a custom namespace specified in the title, it looks like a page move somehow failed and left the page in the main namespace but renamed the title. I can see the page now in my wiki if I search but when I try to click on the link it shows up as a blank. I guess I'll go db diving to see if I can fix it. and backup my db first.

Fixing the DB to remove the namespace from the title, and setting the namespace column to the proper number in the pages table fixed my problem page.

This ticket is just for a recommendation in hardening Cargo against this kind of corrupt data in the future. Wether it originated from a mediawiki bug or user error during a move I cannot tell atm.

Thanks!

Yaron_Koren claimed this task.

That's a good idea - I added in this code in 0069ae1265dc.