Page MenuHomePhabricator

Frontpage of wikidata wiki of the vagrant role wikidata shows error mssage
Closed, ResolvedPublic

Description

I created a new labs-instance and now I'm getting an internal error on the front page
http://wikidata-drmf2016.wmflabs.org/wiki/Main_Page
MWContentSerializationException from line 218 of /vagrant/mediawiki/extensions/WikidataBuildResources/extensions/Wikibase/lib/includes/store/EntityContentDataCodec.php: Failed to decode as application/json
It seems that during installation the main page is filled with some wikitext that can not be changed thereafter
http://wikidata-drmf2016.wmflabs.org/w/index.php?title=Main_Page&action=history

Event Timeline

I am almost certain we already have a task for this, but cant't find it.

Problem is the main page created during installation has wikitext content. Then we set the main namespace to have item content, and then the wikitext main page no longer is handled appropriately.

I think it is possible to explicitly define the content model of the main page as wikitext, though not sure how well wikibase handles this as there are a number of assumptions about namespace being particular content type.

The easiest solution is just move the main page to the project namespace and set the MediaWiki:mainpage message to point to it. Maybe vagrant could be configured to do this.

The easiest solution is just move the main page to the project namespace and set the MediaWiki:mainpage message to point to it. Maybe vagrant could be configured to do this.

Yes I did that for the main wiki in https://github.com/DRMF/operations-puppet-drmf/blob/master/manifests/roles/drmf.pp#L124-L129 , but I'm not sure how to modify the content of the wikidata-wiki using vagrant roles.

@aude Could you add detailed instructions of how to manually fix this here on the bug?

@bd808 for moving, I would:

  1. temporarily disable WikibaseRepo
  2. move the main page (e.g. to "Wikidata:Main Page" if there is a Wikidata namespace)
  3. update MediaWiki:mainpage to be "Wikidata:Main Page"
  4. re-enable Wikibase

maybe a better solution could be to have location of the main page (contents of MediaWiki:mainpage) as optional configuration during install? though not sure I like adding yet another install option.

I hit this today :(
@aude your instructions don't make sense to me. How do I do step #2 and #3? Via a script?

For now, I'm just going to repoint it to a different page and create that page. If you visit Main Page, it will still be broken, but we can live with that temporarily.

One annoyance in this context is that you can't even delete the broken page. That's actually a core issue. Here's a patch for fixing that: https://gerrit.wikimedia.org/r/#/c/296059/

The next step would be to have the database updater migrate the main page... but how should it know where to migrate to?

Maybe we could just make a maintenance script what upon detecting that page.page_content_model != revision.rev_content_model for latest revision (accounting for current defaults) would just set it to the right one in the revision table?

Also seems to be related to T104033.

Change 296793 had a related patch set uploaded (by Smalyshev):
Add script to fix revision table after default content model is changed

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

Change 297721 had a related patch set uploaded (by Mattflaschen):
Create a separate Wikidata main page

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

Change 297787 had a related patch set uploaded (by Daniel Kinzler):
If rev_content_model is null, use page_content_model.

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

Change 296793 abandoned by Smalyshev:
Add script to fix revision table after default content model is changed

Reason:
replace by I75c60eb1294

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

Change 297787 merged by jenkins-bot:
If rev_content_model is null, use page_content_model.

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

With https://gerrit.wikimedia.org/r/297787 merged, I think we can close this once
https://gerrit.wikimedia.org/r/#/c/296059/ is merged.

It would however be nice to allow the main page to be moved to another namespace. I filed T139877 for that.

Oh, on the Vagrant side, https://gerrit.wikimedia.org/r/#/c/297721/ should probably also go in before we close this.

With https://gerrit.wikimedia.org/r/297787 merged, I think we can close this once
https://gerrit.wikimedia.org/r/#/c/296059/ is merged.

First one was reverted.

The next step would be to have the database updater migrate the main page... but how should it know where to migrate to?

With this approach: You only need to migrate it if it's in the main namespace (not always true, e.g. https://de.wikipedia.org/wiki/Wikipedia:Hauptseite). You can just prepend:

MWNamespace::getCanonicalName( NS_PROJECT ) . ':'

to get the new name, since that namespace should always exist.

With this approach: You only need to migrate it if it's in the main namespace (not always true, e.g. https://de.wikipedia.org/wiki/Wikipedia:Hauptseite). You can just prepend:

MWNamespace::getCanonicalName( NS_PROJECT ) . ':'

to get the new name, since that namespace should always exist.

Using the Project namespace is sensible, but is it always what the user wants? What happens if that page already exists? And: should MediaWiki:mainpage be changed to pint to the new page?

With this approach: You only need to migrate it if it's in the main namespace (not always true, e.g. https://de.wikipedia.org/wiki/Wikipedia:Hauptseite). You can just prepend:

MWNamespace::getCanonicalName( NS_PROJECT ) . ':'

to get the new name, since that namespace should always exist.

Using the Project namespace is sensible, but is it always what the user wants?

Probably not, but if you want to auto-migrate it, it can't ask for input. The alternative to auto-migration is to fail the update.php with an error such as "Main page is in the main namespace. Please move the main page to a page in another namespace, such as Project:Main_Page, update MediaWiki:Mainpage, and try again."

What happens if that page already exists?

I guess fail it with a similar error to above.

And: should MediaWiki:mainpage be changed to pint to the new page?

Yes. Otherwise, it will still point to an invalid title, with a non-existent page, in a JSON namespace, which is still undesirable.

Change 297721 merged by jenkins-bot:
Create a separate Wikidata main page

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