Page MenuHomePhabricator

WikidataPageBanner doesn't seem to use wpb_banner wpb_banner_focus_x or wpb_banner_focus_y page properties
Open, MediumPublic

Description

This code exists in Hooks.php:

			// add custom or wikidata banner properties to page_props table if a valid banner exists
			// in, checking for custom banner first, then wikidata banner
			if ( $bannerTitle !== null ) {
				$parser->getOutput()->setExtensionData( 'wpb-banner-options', $paramsForBannerTemplate );
				$parser->fetchFileAndTitle( $bannerTitle );
				$parser->getOutput()->setUnsortedPageProperty( 'wpb_banner', $bannerTitle->getText() );
				$parser->getOutput()->setUnsortedPageProperty( 'wpb_banner_focus_x',
						$paramsForBannerTemplate['data-pos-x'] ?? '' );
				$parser->getOutput()->setUnsortedPageProperty( 'wpb_banner_focus_y',
						$paramsForBannerTemplate['data-pos-y'] ?? '' );
			}
		}

But these properties don't seem to be used anywhere:

Including unused in client-side gadgets as far as I can tell:

This is likely dead code that can be removed.

Related Objects

Event Timeline

cscott renamed this task from WikidataPageBannder doesn to WikidataPageBannder doesn't seem to use wpb_banner wpb_banner_focus_x or wpb_banner_focus_y page properties.Tue, Apr 16, 1:43 PM
cscott claimed this task.
cscott added a project: Wikidata-Page-Banner.
cscott updated the task description. (Show Details)

Change #1020220 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/WikidataPageBanner@master] Remove unused page properties wpb_banner, wpb_banner_focus_x, wpb_banner_focus_y

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

Aklapper renamed this task from WikidataPageBannder doesn't seem to use wpb_banner wpb_banner_focus_x or wpb_banner_focus_y page properties to WikidataPageBanner doesn't seem to use wpb_banner wpb_banner_focus_x or wpb_banner_focus_y page properties.Tue, Apr 16, 2:01 PM
thiemowmde subscribed.

I found T114424#7554051. It makes it sound like this was indeed never used.

Yeah, and if T114424 were to be resurrected, it could/should use ParserOutput::setExtensionData, since all the code paths described have just parsed the banner template and thus have the ParserOutput available. PageProps is for when you want to index content independent of the parse, not when you just want to add metadata to the parse.

Jdlrobson triaged this task as Medium priority.Wed, Apr 24, 3:11 PM

Change #1020220 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] Remove unused page properties wpb_banner, wpb_banner_focus_x, wpb_banner_focus_y

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

Some context: https://www.mediawiki.org/wiki/Extension:WikidataPageBanner#'origin'_parameter
It looks like this feature is broken, so presumably it got broken at some point?
Seems to be working on https://en.m.wikivoyage.beta.wmflabs.org/w/index.php?title=London#

There is a single place in the code that uses the data-pos-x and data-pos-y attributes from the DOM. I assume this is what we see in action. The page properties appear to be unrelated to that.