Page MenuHomePhabricator

Move Content::prepareSave method that don't belong in Content to ContentHandler
Closed, ResolvedPublic

Description

These methods need to move to new corresponding methods in ContentHandler. Here's a patch that does the first part of the work for Content::preSaveTransform.

The signature of the ContentHandler method should be:

  • ContentHandler::prepareSave( Content, PageRecord, int, int, UserIdentity ) // TODO: discuss if PageRecord is needed or we can just do PageIdentity/Reference

The process:

  • Do the same as in the referenced patch for all the methods. -> Patch
  • In all extensions where Content overriding classes override the method - override the ContentHandler method instead
    • Wikibase (deployed) -> Patch
    • ProofreadPage (deployed) -> Patch
    • Scribunto (deployed) -> Patch
    • TemplateStyles (deployed) -> Patch
    • Translate (deployed) -> Patch
    • examples -> Patch
    • StructuredNavigation -> Ticket
    • TEI -> Ticket
    • WikiLambda -> Ticket
    • SemanticMediaWiki -> Ticket
  • Replace all callers. Use ContentHandlerFactory to obtain a ContentHandler, not the Content::getContentHandler method
  • Once all callers and overrides in extensions is done, do some hard deprecations. Add version parameter to MWDebug::detectDeprecatedOverride in deprecation check. -> Patch

Event Timeline

daniel triaged this task as High priority.Aug 17 2021, 3:45 PM

Change 732962 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/core@master] Move Content::prepareSave to ContentHandler

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

Change 734261 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/Wikibase@master] Override ContentHandler::confirmSave instead of Content::prepareSave.

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

Change 734949 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/ProofreadPage@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 734950 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/Scribunto@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 734957 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/TemplateStyles@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 734960 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/Translate@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 735395 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/extensions/examples@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 737030 had a related patch set uploaded (by Roman Stolar; author: Roman Stolar):

[mediawiki/core@master] Hard-deprecate Content::prepareSave.

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

Change 732962 merged by jenkins-bot:

[mediawiki/core@master] Move Content::prepareSave to ContentHandler

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

Change 735395 merged by jenkins-bot:

[mediawiki/extensions/examples@master] Override ContentHandler::validateForRevision instead of Content::prepareSave.

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

Change 734957 merged by jenkins-bot:

[mediawiki/extensions/TemplateStyles@master] Override ContentHandler::validateSave instead of Content::prepareSave.

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

Change 734950 merged by jenkins-bot:

[mediawiki/extensions/Scribunto@master] Override ContentHandler::validateSave instead of Content::prepareSave.

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

Change 734949 merged by jenkins-bot:

[mediawiki/extensions/ProofreadPage@master] Override ContentHandler::validateSave instead of Content::prepareSave.

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

Change 734960 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Override ContentHandler::validateSave instead of Content::prepareSave.

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

Change 734261 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Override ContentHandler::validateSave instead of Content::prepareSave.

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

Change 737030 merged by jenkins-bot:

[mediawiki/core@master] Hard-deprecate Content::prepareSave.

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