Page MenuHomePhabricator

MediaWiki-ContentHandlerComponent
ActivePublic

Details

Description

The ContentHandler facility provides a way to represent the content of a wiki page, and the various ways in which that content can be interpreted, or transformed. For example, in which format to store it in a database, and how to render the content as HTML.

This includes the Content and ContentHandler interfaces, and those implementations that are part of MediaWiki core.

For how content objects are stored and their association with pages and edits, see MediaWiki-Core-Revision-backend.

See also:

Parent project: MediaWiki-General

Recent Activity

Fri, May 23

Jdlrobson-WMF moved T107709: Disable Collection generation for non-wikitext content models from Backlog to Triaged (PHP) on the Collection board.
Fri, May 23, 11:35 PM · Collection, MediaWiki-ContentHandler

May 8 2025

matej_suchanek added a comment to T392769: Impossible-to-categorise pages should be categorisable, somehow.

I can't see how it could get parsed.

May 8 2025, 4:02 PM · MediaWiki-ContentHandler, MediaWiki-Categories
Bugreporter2 added a comment to T392769: Impossible-to-categorise pages should be categorisable, somehow.

They are always categorizable programmatically. The respective content handler just needs to provide a "side channel" for categorization. This could be for example a reserved JSON key or even a new MCR slot.

May 8 2025, 11:06 AM · MediaWiki-ContentHandler, MediaWiki-Categories

Apr 28 2025

matej_suchanek added a comment to T392769: Impossible-to-categorise pages should be categorisable, somehow.

They are always categorizable programmatically. The respective content handler just needs to provide a "side channel" for categorization. This could be for example a reserved JSON key or even a new MCR slot.

Apr 28 2025, 11:19 AM · MediaWiki-ContentHandler, MediaWiki-Categories
Izno edited projects for T392769: Impossible-to-categorise pages should be categorisable, somehow, added: MediaWiki-ContentHandler; removed Multi-Content-Revisions.
Apr 28 2025, 6:59 AM · MediaWiki-ContentHandler, MediaWiki-Categories

Apr 25 2025

Izno added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

Wrapping everything in <syntaxhighlight lang=json> makes a completely incoherent neon-coloured headache-inducing mess. There is no lang=regex option, but there are, at least, other language options that aren't quite as bad.

image.png (837×1 px, 270 KB)
Apr 25 2025, 12:15 AM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist

Apr 24 2025

Bugreporter2 added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

Wrapping everything in <syntaxhighlight lang=json> makes a completely incoherent neon-coloured headache-inducing mess. There is no lang=regex option, but there are, at least, other language options that aren't quite as bad.

Apr 24 2025, 11:52 PM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist
Izno added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

And using a JSON content model as in the new BlockedDomains would likely highlight regexes appropriately anyway. So yes, I more or less agree with that suggestion regarding the context of the spam blacklist.

Apr 24 2025, 6:34 PM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist

Apr 23 2025

Ladsgroup added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

I would suggest forking the spam related content to a new task to be a child of T337431: Rework MediaWiki:SpamBlacklist and this task.

Apr 23 2025, 11:48 AM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist

Apr 20 2025

Bugreporter2 added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

I note the plan with T337431 is to completely deprecate the MediaWiki:Spamblacklist.

Apr 20 2025, 1:11 AM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist

Apr 19 2025

Izno added a comment to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages..

I would suggest forking the spam related content to a new task to be a child of T337431: Rework MediaWiki:SpamBlacklist and this task.

Apr 19 2025, 10:33 PM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist
Gustmd7410 added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.
Apr 19 2025, 5:57 PM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing
Gustmd7410 added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.

The author thought it should just reported "Content format not supported" instead, but I think it should be noted that even though the model=wikitext parameter is given, the parameter is not recognized and the error message text/x-wiki is not supported for content model javascript is displayed.

Apr 19 2025, 5:54 PM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing
Gustmd7410 added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.

Try to manually add URL query parameter

Hmm, why would you do that?

Apr 19 2025, 5:36 PM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing
Pppery added a project to T392330: Regex lists should have distinct content model, including syntax highlighting and line numbers like CSS/Javascript pages.: MediaWiki-ContentHandler.
Apr 19 2025, 2:05 PM · MediaWiki-ContentHandler, ConfirmEdit (CAPTCHA extension), SpamBlacklist, TitleBlacklist

Apr 14 2025

Reedy moved T391524: MWException: Format text/x-wiki is not supported for content model javascript from Untriaged to Apr-Jun 2025 on the Wikimedia-production-error board.
Apr 14 2025, 5:40 PM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing

Apr 10 2025

Aklapper added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.

Try to manually add URL query parameter

Apr 10 2025, 9:27 AM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing
Libamidi added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.

Thanks for reporting this! Cannot reproduce.

Apr 10 2025, 8:17 AM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing
Aklapper added a comment to T391524: MWException: Format text/x-wiki is not supported for content model javascript.

Thanks for reporting this! Cannot reproduce.

Apr 10 2025, 6:13 AM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing

Apr 9 2025

Libamidi created T391524: MWException: Format text/x-wiki is not supported for content model javascript.
Apr 9 2025, 8:29 PM · MediaWiki-ContentHandler, Wikimedia-production-error, MediaWiki-Page-editing

Apr 8 2025

Aklapper moved T347073: MWException: Format text/x-wiki is not supported for content model Scribunto from External to Backlog on the Scribunto board.
Apr 8 2025, 11:48 AM · MediaWiki-ContentHandler, User-brennen, Scribunto, MediaWiki-Page-editing, Wikimedia-production-error

Mar 31 2025

Aklapper added projects to T351798: Special:ChangeContentModel: should use HTTP GET instead of HTTP POST for first of the two forms: MediaWiki-ContentHandler, Technical-Debt.
Mar 31 2025, 8:18 AM · Technical-Debt, MediaWiki-ContentHandler

Mar 16 2025

This_was_the_i moved T347073: MWException: Format text/x-wiki is not supported for content model Scribunto from Backlog to External on the Scribunto board.
Mar 16 2025, 12:22 PM · MediaWiki-ContentHandler, User-brennen, Scribunto, MediaWiki-Page-editing, Wikimedia-production-error

Mar 3 2025

Pppery changed the status of T85847: Grant editcontentmodel right to all logged in users from Open to Stalled.
Mar 3 2025, 5:43 AM · Wikimedia-Site-requests, Community-consensus-needed, MW-1.28-release (WMF-deploy-2016-09-13_(1.28.0-wmf.19)), MW-1.28-release-notes, MW-1.27-release-notes, MW-1.27-release (WMF-deploy-2016-03-01_(1.27.0-wmf.15)), MediaWiki-ContentHandler
Pppery changed the status of T85847: Grant editcontentmodel right to all logged in users, a subtask of T92795: Users without 'editcontentmodel' user right cannot create MassMessage delivery lists, from Open to Stalled.
Mar 3 2025, 5:43 AM · Patch-For-Review, MediaWiki-ContentHandler, MassMessage

Feb 16 2025

Pppery merged task T206395: Allow to display something above articles with JSON, JS and CSS content-models into T355159: New system message – documentation header for non-wikitext pages.
Feb 16 2025, 8:11 PM · MediaWiki-General, MediaWiki-ContentHandler

Feb 11 2025

Pppery added a project to T347073: MWException: Format text/x-wiki is not supported for content model Scribunto: MediaWiki-ContentHandler.
Feb 11 2025, 4:46 PM · MediaWiki-ContentHandler, User-brennen, Scribunto, MediaWiki-Page-editing, Wikimedia-production-error

Jan 17 2025

Maintenance_bot removed a project from T268041: Deprecate and remove ContentHandler::getContentText() and $wgContentHandlerTextFallback: Patch-For-Review.
Jan 17 2025, 4:31 PM · MW-1.43-notes (1.43.0-wmf.2; 2024-04-23), MediaWiki-ContentHandler, Platform Team Workboards (Clinic Duty Team), Technical-Debt (Deprecation process)
gerritbot added a comment to T268041: Deprecate and remove ContentHandler::getContentText() and $wgContentHandlerTextFallback.

Change #1112091 merged by jenkins-bot:

[mediawiki/extensions/AccessControl@master] Replace deprecated ContentHandler::getContentText()

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

Jan 17 2025, 3:47 PM · MW-1.43-notes (1.43.0-wmf.2; 2024-04-23), MediaWiki-ContentHandler, Platform Team Workboards (Clinic Duty Team), Technical-Debt (Deprecation process)

Jan 16 2025

gerritbot added a project to T268041: Deprecate and remove ContentHandler::getContentText() and $wgContentHandlerTextFallback: Patch-For-Review.
Jan 16 2025, 8:31 PM · MW-1.43-notes (1.43.0-wmf.2; 2024-04-23), MediaWiki-ContentHandler, Platform Team Workboards (Clinic Duty Team), Technical-Debt (Deprecation process)
gerritbot added a comment to T268041: Deprecate and remove ContentHandler::getContentText() and $wgContentHandlerTextFallback.

Change #1112091 had a related patch set uploaded (by Wargo; author: Wargo):

[mediawiki/extensions/AccessControl@master] Replace deprecated ContentHandler::getContentText()

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

Jan 16 2025, 8:30 PM · MW-1.43-notes (1.43.0-wmf.2; 2024-04-23), MediaWiki-ContentHandler, Platform Team Workboards (Clinic Duty Team), Technical-Debt (Deprecation process)

Dec 25 2024

Pppery moved T152282: WikiRevision::getText() needs fixing up from Backlog to Both import and export on the MediaWiki-Core-Snapshots board.
Dec 25 2024, 6:08 AM · MediaWiki-Core-Snapshots, MediaWiki-ContentHandler

Dec 17 2024

matmarex closed T106921: Title validation on Special:ChangeContentModel only happens after submitting full form as Resolved.

I can't reproduce this. It was probably fixed by making both forms on that page use POST, in T196514.

Dec 17 2024, 9:41 PM · MediaWiki-ContentHandler, MediaWiki-HTMLForm

Nov 25 2024

Pppery moved T85847: Grant editcontentmodel right to all logged in users from Backlog to Blocked on community consensus on the Wikimedia-Site-requests board.
Nov 25 2024, 4:46 PM · Wikimedia-Site-requests, Community-consensus-needed, MW-1.28-release (WMF-deploy-2016-09-13_(1.28.0-wmf.19)), MW-1.28-release-notes, MW-1.27-release-notes, MW-1.27-release (WMF-deploy-2016-03-01_(1.27.0-wmf.15)), MediaWiki-ContentHandler
Pppery added a project to T85847: Grant editcontentmodel right to all logged in users: Wikimedia-Site-requests.
Nov 25 2024, 4:46 PM · Wikimedia-Site-requests, Community-consensus-needed, MW-1.28-release (WMF-deploy-2016-09-13_(1.28.0-wmf.19)), MW-1.28-release-notes, MW-1.27-release-notes, MW-1.27-release (WMF-deploy-2016-03-01_(1.27.0-wmf.15)), MediaWiki-ContentHandler
matmarex added a comment to T380691: Page creation should have drop-down to specify content model.

You can also create a page with non-default content model by going to Special:ChangeContentModel directly, and inputting a title of a page that doesn't exist yet. We could do something to make it more obvious that this works.

Nov 25 2024, 1:00 PM · MediaWiki-ContentHandler, MediaWiki-Page-editing
Pppery added a comment to T380691: Page creation should have drop-down to specify content model.

That would be T29311

Nov 25 2024, 4:54 AM · MediaWiki-ContentHandler, MediaWiki-Page-editing

Nov 24 2024

Izno added a comment to T380691: Page creation should have drop-down to specify content model.

Or perhaps a [[Special:NewPage]] with a dropdown would also be fine? This would also help us get out of having to tell new users "make a red link and then click the red link" type of discussion that often occurs.

Nov 24 2024, 11:49 PM · MediaWiki-ContentHandler, MediaWiki-Page-editing
Izno added a comment to T380691: Page creation should have drop-down to specify content model.

I thought about something like this a couple weeks ago. I'm sympathetic to the desire, but also generally agree that we shouldn't have such a dropdown.

Nov 24 2024, 11:49 PM · MediaWiki-ContentHandler, MediaWiki-Page-editing
Pppery added a project to T380691: Page creation should have drop-down to specify content model: MediaWiki-ContentHandler.

Yeah, I agree with Wargo - this is a rare enough use case on most wikis that the current situation of having to manually go do Special:ChangeContentModel is fine.

Nov 24 2024, 7:48 PM · MediaWiki-ContentHandler, MediaWiki-Page-editing

Nov 14 2024

Pppery added a project to T360266: "Error: Call to a member function getModel() on null" undeleting edits on Serbian Wikipedia: MediaWiki-ContentHandler.

Probably some sort of pre-contenthandler DB corruption.

Nov 14 2024, 6:55 PM · MediaWiki-ContentHandler, Serbian-Sites, MediaWiki-Page-deletion, Wikimedia-production-error

Oct 27 2024

Maintenance_bot removed a project from T372500: PHP Fatal Error from /srv/mediawiki/php-1.43.0-wmf.17/includes/content/WikitextContent.php: Cannot declare class WikitextContent, because the name is already in use: Patch-For-Review.
Oct 27 2024, 10:30 PM · MW-1.42-notes, MW-1.39-notes, MW-1.41-notes, MW-1.43-notes, MW-1.44-notes (1.44.0-wmf.1; 2024-10-29), MediaWiki-ContentHandler, MediaWiki-General, Wikimedia-production-error
gerritbot added a comment to T372500: PHP Fatal Error from /srv/mediawiki/php-1.43.0-wmf.17/includes/content/WikitextContent.php: Cannot declare class WikitextContent, because the name is already in use.

Change #1082585 abandoned by Reedy:

[mediawiki/core@wmf/1.43.0-wmf.28] AutoLoader: Use require_once rather than require

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

Oct 27 2024, 9:45 PM · MW-1.42-notes, MW-1.39-notes, MW-1.41-notes, MW-1.43-notes, MW-1.44-notes (1.44.0-wmf.1; 2024-10-29), MediaWiki-ContentHandler, MediaWiki-General, Wikimedia-production-error
gerritbot added a comment to T372500: PHP Fatal Error from /srv/mediawiki/php-1.43.0-wmf.17/includes/content/WikitextContent.php: Cannot declare class WikitextContent, because the name is already in use.

Change #1082586 abandoned by Reedy:

[mediawiki/core@wmf/1.43.0-wmf.27] AutoLoader: Use require_once rather than require

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

Oct 27 2024, 9:44 PM · MW-1.42-notes, MW-1.39-notes, MW-1.41-notes, MW-1.43-notes, MW-1.44-notes (1.44.0-wmf.1; 2024-10-29), MediaWiki-ContentHandler, MediaWiki-General, Wikimedia-production-error

Oct 26 2024

Pppery removed a project from T230968: Special:ChangeContentModel should check if a page exists: MediaWiki-Special-pages.
Oct 26 2024, 4:23 PM · User-DannyS712, MediaWiki-ContentHandler
Pppery removed a project from T16247: Provide Autosumm-blank and Autosumm-replace message with CSS class: MediaWiki-Special-pages.
Oct 26 2024, 4:22 PM · MediaWiki-ContentHandler, CSS, MediaWiki-User-Interface, OKR-Work
Pppery removed a project from T283000: Error message about missing permissions at Special:ChangeContentModel is duplicated: MediaWiki-Special-pages.
Oct 26 2024, 4:19 PM · MediaWiki-ContentHandler, Platform Team Workboards (MW Expedition)
Pppery removed a project from T351798: Special:ChangeContentModel: should use HTTP GET instead of HTTP POST for first of the two forms: MediaWiki-Special-pages.
Oct 26 2024, 4:12 PM · Technical-Debt, MediaWiki-ContentHandler

Oct 24 2024

ReleaseTaggerBot added projects to T372500: PHP Fatal Error from /srv/mediawiki/php-1.43.0-wmf.17/includes/content/WikitextContent.php: Cannot declare class WikitextContent, because the name is already in use: MW-1.43-notes, MW-1.41-notes, MW-1.39-notes, MW-1.42-notes.
Oct 24 2024, 3:00 AM · MW-1.42-notes, MW-1.39-notes, MW-1.41-notes, MW-1.43-notes, MW-1.44-notes (1.44.0-wmf.1; 2024-10-29), MediaWiki-ContentHandler, MediaWiki-General, Wikimedia-production-error
gerritbot added a comment to T372500: PHP Fatal Error from /srv/mediawiki/php-1.43.0-wmf.17/includes/content/WikitextContent.php: Cannot declare class WikitextContent, because the name is already in use.

Change #1082587 merged by jenkins-bot:

[mediawiki/core@REL1_43] AutoLoader: Use require_once rather than require

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

Oct 24 2024, 2:19 AM · MW-1.42-notes, MW-1.39-notes, MW-1.41-notes, MW-1.43-notes, MW-1.44-notes (1.44.0-wmf.1; 2024-10-29), MediaWiki-ContentHandler, MediaWiki-General, Wikimedia-production-error