Paste P7805

(An Untitled Masterwork)
ActivePublic

Authored by Addshore on Wed, Nov 14, 6:45 PM.
diff --git a/lib/includes/Formatters/ControlledFallbackEntityIdFormatter.php b/lib/includes/Formatters/ControlledFallbackEntityIdFormatter.php
index 52a41811f..1b200ea12 100644
--- a/lib/includes/Formatters/ControlledFallbackEntityIdFormatter.php
+++ b/lib/includes/Formatters/ControlledFallbackEntityIdFormatter.php
@@ -71,7 +71,13 @@ class ControlledFallbackEntityIdFormatter implements EntityIdFormatter {
}
public function formatEntityId( EntityId $value ) {
- if ( $value instanceof Int32EntityId && $value->getNumericId() <= $this->maxEntityId ) {
+ $testHeader = \RequestContext::getMain()->getRequest()->getHeader( 'X-WIKIBASE-formatEntityId' );
+ wfDebugLog( 'AdHocDebug', json_encode( $testHeader ) );
+ if (
+ ( $value instanceof Int32EntityId && $value->getNumericId() <= $this->maxEntityId && $testHeader !== 'old' ) ||
+ ( $testHeader === 'new' )
+ ) {
+ wfDebugLog( 'AdHocDebug', 'Trying new / target formatter' );
try {
$formatEntityId = $this->targetFormatter->formatEntityId( $value );
$this->statsdDataFactory->increment( $this->statsPrefix . 'targetFormatterCalled' );