r114211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114210‎ | r114211 | r114212 >
Date:23:19, 19 March 2012
Author:awjrichards
Status:ok (Comments)
Tags:
Comment:
Added invocation of GetCacheVaryCookies hook to ad 'mf_useformat' cookie to x-vary-options
Modified paths:
  • /trunk/extensions/MobileFrontend/MobileFrontend.body.php (modified) (history)
  • /trunk/extensions/MobileFrontend/MobileFrontend.php (modified) (history)
  • /trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MobileFrontend/MobileFrontend.body.php
@@ -1503,6 +1503,11 @@
15041504 return $expiry;
15051505 }
15061506
 1507+ public function getCacheVaryCookies( $out, &$cookies ) {
 1508+ global $wgCookiePrefix;
 1509+ $cookies[] = $wgCookiePrefix . 'mf_useformat';
 1510+ }
 1511+
15071512 /**
15081513 * Determine the duration the cookie should last.
15091514 *
Index: trunk/extensions/MobileFrontend/MobileFrontend.php
@@ -121,6 +121,8 @@
122122 */
123123 $wgMobileRedirectFormAction = false;
124124
 125+$wgMobileResourceVersion;
 126+
125127 $wgExtMobileFrontend = null;
126128
127129 $wgExtensionFunctions[] = 'efMobileFrontend_Setup';
@@ -134,6 +136,7 @@
135137 $wgHooks['APIGetDescription'][] = 'ApiParseExtender::onAPIGetDescription';
136138 $wgHooks['OpenSearchXml'][] = 'ApiQueryExtracts::onOpenSearchXml';
137139
 140+
138141 function efMobileFrontend_Setup() {
139142 global $wgExtMobileFrontend, $wgHooks;
140143 $wgExtMobileFrontend = new ExtMobileFrontend();
@@ -142,6 +145,7 @@
143146 $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( &$wgExtMobileFrontend, 'addMobileFooter' );
144147 $wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 'testCanonicalRedirect' );
145148 $wgHooks['ResourceLoaderTestModules'][] = array( &$wgExtMobileFrontend, 'addTestModules' );
 149+ $wgHooks['GetCacheVaryCookies'][] = array( &$wgExtMobileFrontend, 'getCacheVaryCookies' );
146150 }
147151
148152 /**
Index: trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php
@@ -7,7 +7,7 @@
88 class ApplicationTemplate extends MobileFrontendTemplate {
99
1010 public function getHTML() {
11 -
 11+ global $wgMobileResourceVersion;
1212 if ( $this->data['wgAppleTouchIcon'] !== false ) {
1313 $appleTouchIconTag = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $this->data['wgAppleTouchIcon'] ) );
1414 } else {
@@ -36,7 +36,7 @@
3737
3838 $jQuerySupport = $this->data['device']['supports_jquery'];
3939 $jQueryScript = $jQuerySupport ? $startScriptTag . $javaScriptPath . 'jquery-1.7.1.min.js' . $endScriptTag : '';
40 - $filePageScript = ( $this->data['isFilePage'] ) ? $startScriptTag . $javaScriptPath . 'filepage.js?version=1332193250' . $endScriptTag : '';
 40+ $filePageScript = ( $this->data['isFilePage'] ) ? $startScriptTag . $javaScriptPath . 'filepage.js?version=' . $wgMobileResourceVersion . $endScriptTag : '';
4141
4242 $startLinkTag = "<link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/";
4343 $endLinkTag = "' media='all' rel='Stylesheet' type='text/css' />";
@@ -59,7 +59,7 @@
6060
6161 if( $this->data['isBetaGroupMember'] && $jQuerySupport ) {
6262 $betajs = <<<HTML
63 - {$startScriptTag}{$javaScriptPath}references.{$resourceSuffix}js?version=1332193250{$endScriptTag}
 63+ {$startScriptTag}{$javaScriptPath}references.{$resourceSuffix}js?version={$wgMobileResourceVersion}{$endScriptTag}
6464 HTML;
6565 } else {
6666 $betajs = "";
@@ -71,8 +71,8 @@
7272 <head>
7373 <title>{$this->data['htmlTitle']}</title>
7474 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
75 - <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1332193250' media='all' rel='Stylesheet' type='text/css' />
76 - <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1332193250' media='all' rel='Stylesheet' type='text/css' />
 75+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version={$wgMobileResourceVersion}' media='all' rel='Stylesheet' type='text/css' />
 76+ <link href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version={$wgMobileResourceVersion}' media='all' rel='Stylesheet' type='text/css' />
7777 {$filePageStyle}
7878 <meta name="viewport" content="initial-scale=1.0">
7979 {$appleTouchIconTag}

Follow-up revisions

RevisionCommit summaryAuthorDate
r114212Finishing implementation of accidentally checked in in previous commitawjrichards23:21, 19 March 2012
r114213MFT r114211, r114212awjrichards23:25, 19 March 2012
r114214Followup r114211, adding return true to hook invocationawjrichards23:32, 19 March 2012

Comments

#Comment by Preilly (talk | contribs)   23:34, 19 March 2012

The getCacheVaryCookies hook is missing a return value.

Status & tagging log