Page MenuHomePhabricator

Exception error occurs when editing JSON pages on th.wp/th.wikt
Closed, ResolvedPublic

Description

  1. Open my user pages end with .json :

https://th.wikipedia.org/wiki/User:Octahedron80/legacyThaiPUA.json
https://th.wiktionary.org/wiki/User:Octahedron80/legacyThaiPUA.json

  1. Click edit tab.
  2. Internal error happens. End.

I hope someone can resolve this.
PS. My JSON is already well-formatted.

Details

Related Gerrit Patches:

Event Timeline

Octahedron80 raised the priority of this task from to Needs Triage.
Octahedron80 updated the task description. (Show Details)
Octahedron80 added a subscriber: Octahedron80.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 11 2015, 4:00 AM
Octahedron80 updated the task description. (Show Details)Aug 11 2015, 4:01 AM
Octahedron80 set Security to None.
Aklapper changed the task status from Open to Stalled.Aug 11 2015, 2:30 PM

Please fix the local gadget's Javascript first - you can find out more by taking a look at your browser's console:

The output in this case is:

"Gadget "imagelinks" was not loaded. Please migrate it to use ResourceLoader.  See <https://th.wiktionary.org/wiki/%E0%B8%9E%E0%B8%B4%E0%B9%80%E0%B8%A8%E0%B8%A9:%E0%B8%AD%E0%B8%B8%E0%B8%9B%E0%B8%81%E0%B8%A3%E0%B8%93%E0%B9%8C%E0%B9%80%E0%B8%AA%E0%B8%A3%E0%B8%B4%E0%B8%A1>."
"Use of "wgNamespaceNumber" is deprecated. Use mw.config instead."

If there is still a problem after fixing the on-wiki code, please reopen this task.
Thank you!

Aklapper renamed this task from Error occurs when to edit JSON to Error occurs when editing on th.wp (due to Gadget "imagelinks" not ported to ResourceLoader yet).Aug 11 2015, 2:30 PM
Aklapper triaged this task as Lowest priority.
Octahedron80 added a comment.EditedAug 12 2015, 1:35 AM

I am afraid that current local admins are not able to do this because they don't know about coding. I think we need a global staff to modify on all Thai projects.

Fixing this does not require "global staff" (though I'm not sure what that is). It requires a sysop on th.wiktionary.org, as https://www.mediawiki.org/wiki/ResourceLoader/Migration_guide_%28users%29 states: "Problems with gadgets? Check if it's listed below. If so, ask a sysop to update it on your wiki."

https://th.wiktionary.org/wiki/มีเดียวิกิ:Gadget-imagelinks.js says "Imported from version 9 as of 2012-12-08". That was 31 months ago.
The version at https://en.wikipedia.org/wiki/MediaWiki:Gadget-imagelinks.js for example is from May 2014. I don't know from where exactly th.wiktionary copied its version from, but that version is ancient and broken and needs to be updated by a th.wiktionary sysop.

Schnark changed the task status from Stalled to Open.Aug 12 2015, 10:37 AM
Schnark added a subscriber: Schnark.

Aklapper, when a page throws an error on server side

[e61439e5] 2015-08-12 10:30:30: Fatal exception of type "MWException"

this is quite obviously not caused by a gadget, which operates (or not, as in this case) on client side. But even if it was, a server error with status code 500 is always a bug in MW, never on-wiki.

Schnark renamed this task from Error occurs when editing on th.wp (due to Gadget "imagelinks" not ported to ResourceLoader yet) to Error occurs when editing some JSON pages on th.wp/th.wikt.Aug 12 2015, 10:37 AM
Octahedron80 added a comment.EditedAug 12 2015, 2:32 PM

A bureaucrat on thwp has updated script as you suggested (only for one project). But the internal error still occurs when editting. So the problem doesn't come from gadgets. Please don't overlook this.

2015-08-12 14:54:47 mw1030 thwiki exception ERROR: [33567135] /w/index.php?title=%E0%B8%9C%E0%B8%B9%E0%B9%89%E0%B9%83%E0%B8%8A%E0%B9%89:Octahedron80/legacyThaiPUA.json&action=edit   MWException from line 600 of /srv/mediawiki/php-1.26wmf17/includes/content/ContentHandler.php: Format text/x-wiki is not supported for content model json {"exception":"[Exception MWException] (/srv/mediawiki/php-1.26wmf17/includes/content/ContentHandler.php:600) Format text/x-wiki is not supported for content model json
[stacktrace]
#0 /srv/mediawiki/php-1.26wmf17/includes/content/TextContentHandler.php(49): ContentHandler->checkFormat(string)
#1 /srv/mediawiki/php-1.26wmf17/includes/content/AbstractContent.php(151): TextContentHandler->serializeContent(JsonContent, string)
#2 /srv/mediawiki/php-1.26wmf17/includes/EditPage.php(2354): AbstractContent->serialize(string)
#3 /srv/mediawiki/php-1.26wmf17/includes/EditPage.php(978): EditPage->toEditText(JsonContent)
#4 /srv/mediawiki/php-1.26wmf17/includes/EditPage.php(566): EditPage->initialiseForm()
#5 /srv/mediawiki/php-1.26wmf17/includes/actions/EditAction.php(56): EditPage->edit()
#6 /srv/mediawiki/php-1.26wmf17/includes/MediaWiki.php(456): EditAction->show()
#7 /srv/mediawiki/php-1.26wmf17/includes/MediaWiki.php(255): MediaWiki->performAction(Article, Title)
#8 /srv/mediawiki/php-1.26wmf17/includes/MediaWiki.php(677): MediaWiki->performRequest()
#9 /srv/mediawiki/php-1.26wmf17/includes/MediaWiki.php(474): MediaWiki->main()
#10 /srv/mediawiki/php-1.26wmf17/index.php(41): MediaWiki->run()
#11 /srv/mediawiki/w/index.php(3): include(string)
#12 {main}
"}
Aklapper renamed this task from Error occurs when editing some JSON pages on th.wp/th.wikt to Exception error occurs when editing JSON pages on th.wp/th.wikt.Aug 12 2015, 2:57 PM
Aklapper raised the priority of this task from Lowest to Needs Triage.Sep 17 2015, 11:39 AM
demon triaged this task as Medium priority.Sep 21 2015, 4:47 PM

See T73163 for root issue.

So...the problem is that the default model was changed, and existing pages weren't updated.

Legoktm claimed this task.Oct 21 2015, 4:50 AM

Change 247783 had a related patch set uploaded (by Legoktm):
Add script to fix content model of JSON pages

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

demon moved this task from Backlog to To be fixed on the MW-1.26-release board.Nov 2 2015, 7:18 PM

Change 255152 had a related patch set uploaded (by Chad):
Add script to fix content model of JSON pages

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

Change 247783 merged by jenkins-bot:
Add script to fix content model of JSON pages

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

Change 255152 merged by jenkins-bot:
Add script to fix content model of JSON pages

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

demon moved this task from To be fixed to Done on the MW-1.26-release board.Nov 24 2015, 6:54 PM
demon added a subscriber: demon.

Fixed in master and REL1_26, still needs running in production so not resolved.

hashar added a subscriber: hashar.Nov 25 2015, 3:55 PM

The bot added MW-1.27-release-notes . Since it got backported to REL1_26 I don't think that is needed.

I ran the script on th.wikt, and it fixed https://th.wiktionary.org/wiki/User:Octahedron80/legacyThaiPUA.json. Can you confirm that page works as expected now and then I'll run it everywhere?

Octahedron80 added a comment.EditedDec 12 2015, 10:18 AM

You asked if it works. Yes it works. It can edit and save. But there is consequence.

How about keep data in escaped form in place they are? (backslash u) Since my data is more visible when they are in escaped form. (By Unicode, my key-pairs currently don't belong to a script.) Converting to typical string may result in data corruption because Mediawiki itself already normalizes some letters.

For example, If I type "a\u0300à", it' means "a\u0300\u00E0". When saving, it should leave it as is rather than to convert to "àà" which becomes unwanted "\u00E0\u00E0"

hashar removed a subscriber: hashar.Dec 12 2015, 7:23 PM

You asked if it works. Yes it works. It can edit and save. But there is consequence.

Awesome, thanks. I'll run the script everywhere now.

How about keep data in escaped form in place they are? (backslash u) Since my data is more visible when they are in escaped form. (By Unicode, my key-pairs currently don't belong to a script.) Converting to typical string may result in data corruption because Mediawiki itself already normalizes some letters.
For example, If I type "a\u0300à", it' means "a\u0300\u00E0". When saving, it should leave it as is rather than to convert to "àà" which becomes unwanted "\u00E0\u00E0"

Could you file this as a separate task please?