On 2013-11-02 11:53 AM, Shawn Jones wrote:
> That makes me feel a little bit better about our dependencies.
>
> Since our rewrite, we only use $wgServer (via abstraction) in two places now,
> and they both involve the TimeMap SpecialPage.
>
> We actually have 3 different types of TimeMaps in the Memento Mediawiki
> Extension:
> 1. full (starter) - shows the latest 500 revisions
> 2. pivot descending - shows the last 500 (or less) revisions prior to a given
> timestamp pivot
> 3. pivot ascending - shows the next 500 (or less) revisions after a given
> timestamp pivot
>
> The pivot ascending and pivot descending TimeMaps are what use the $wgServer
> URI.
>
> They take the form of
> http://example.com/index.php/Special:TimeMap/20130720011113/1/Article for
> ascending and
> http://example.com/index.php/Special:TimeMap/20130720011113/-1/Page for
> descending.
>
> The $wgServer variable is used (as $this->mwbaseurl) to construct the URIs
> like so:
>
> $timeMapPage['uri'] = $this->mwbaseurl . '/'
> . SpecialPage::getTitleFor('TimeMap') . '/'
> . $pivotTimestamp . '/-1/' . $title;
>
> A similar statement exists for a pivot ascending TimeMap elsewhere in the
> code.
>
> I've been trying to find a way to eliminate the use of $wgServer altogether,
> but need to construct these URIs for headers, TimeMap entries, etc.
>
> Is there a better way?
>
$timeMapPage['uri'] = SpecialPage::getTitleFor( 'TimeMap',
$pivotTimestamp . '/-1/' . $title )->get{???}URL();
{???} will be Full, Local, or Canonical depending on where you're
outputting it.
* href="" -> Local
* Somewhere used on other domains -> Full (does output protocol-relative)
* Print and email -> Canonical
* HTTP Headers -> Local + wfExpandUrl( , PROTO_CURRENT ); Unless you
use OutputPage::redirect in which case you can simply use Local as
url expansion is taken care for you.
~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://danielfriesen.name/]
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l