Page MenuHomePhabricator

$wgMobileUrlTemplate ignored if does not start with a placeholder
Closed, DeclinedPublic

Description

Author: niccolo

Description:
I installed MediaWiki 1.21.3 with MobileFrontend 30dad7e on a Debian Wheezy.

If I set the $wgMobileUrlTemplate variable to a fixed constant, like this:

$wgMobileUrlTemplate = 'www.m.mydomain.org';

it is not used at all to compose the "Mobile view" link at the bottom of the page. The standard domain 'www.mydomain.org' is used instead.

If the variable contains a placeholder at the begin, the "Mobile view" link is correct:

$wgMobileUrlTemplate = '%h0.m.%h1.%h2';


Version: unspecified
Severity: enhancement
URL: http://www.google-melange.com/gci/task/view/google/gci2013/5783609470353408

Details

Reference
bz58321

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:42 AM
bzimport set Reference to bz58321.
bzimport added a subscriber: Unknown Object (MLST).

bingle-admin wrote:

Prioritization and scheduling of this bug is tracked on Mingle card https://wikimedia.mingle.thoughtworks.com/projects/mobile/cards/1498

Niccolo, when the functionality for the alternate mobile domain was initially written, it supported a static mobile domain (rather than the template). As the codebase evolved, it appears this functionality disappeared - likely as an oversight. I took a quick look over the host-handling code and I *think* it should be a quick fix, however this is fairly low priority relative to many of the other bugs/new feature work we currently have lined up.

This could be a great bug for a volunteer to pick up. The places to look in the code for resolving this are in includes/MobileContext.php - MobileContext::getMobileUrl() and MobileContext::updateMobileUrlHost(). The related PHPUnit tests will also need an update.

Quim - you know the drill - google code in could work here :D

MediaWiki 1.21.3 (54f7112)
MobileFrontend 0.7.0 (30dad7e)

LocalSettings.php:
require_once("extensions/MobileFrontend/MobileFrontend.php");
$wgMFAutodetectMobileView = true;
$wgMobileUrlTemplate = 'www.m.mydomain.org';

The generated link is: "http://www.m.mydomain.org/[rest of the URL here]"

Am I doing something wrong here? It's looking like there's no bug at all...

Same for me, seems to be working.

GCI task deleted...

Thank you Mateusz for the verification, and sorry for the extra work spent. This is another type of lesson to be learned about things that may happen in any free software project...

Although no patch was needed reviewing the bug was obviously needed - so thanks Mateusz for verifying this is no longer a problem! :)

On a second thought... We have been able to resolve this as WORKSFORME thanks to a first investigation and verification from Mateusz. This should count as a resolved GCI task. Recreated.