Page MenuHomePhabricator

parse.php: Initialize PageConfig properties based on title (-pageName arg OR default)
Closed, ResolvedPublic

Description

See discussion @ https://gerrit.wikimedia.org/r/c/mediawiki/services/parsoid/+/545864/1/src/Wt2Html/DOMPostProcessor.php#720

If you look at the code for src/Config/Api/PageConfig.php for the case where $opts['pageContent'] is passed in, it falls back to 'en' and 'ltr' page properties. However, it should actually be initializing these properties based on the title much like how we do it for the API when we post content against a title and where page properties come from the title object.

Check whether the code paths from parse.php -> MockPageConfig/MWPageConfig also need similar fixes.

Also, note that in Parsoid/PHP, PageConfig::getPageLanguage() and PageConfig::getPageLanguageDir() don't return null values => all conditionals in the codebase around these return values should be eliminated since we are going to be initializing these values correct always after the fixes above.

Details

Related Gerrit Patches:
mediawiki/services/parsoid : masterAdd language converter endpoints to the REST API

Event Timeline

ssastry triaged this task as Medium priority.Oct 24 2019, 8:29 PM
ssastry created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 24 2019, 8:29 PM

Change 545391 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] Add language converter endpoints to the REST API

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

Change 545391 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Add language converter endpoints to the REST API

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

Arlolra closed this task as Resolved.Oct 27 2019, 9:20 PM
Arlolra claimed this task.