https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114211

Revision: 114211
Author:   awjrichards
Date:     2012-03-19 23:19:35 +0000 (Mon, 19 Mar 2012)
Log Message:
-----------
Added invocation of GetCacheVaryCookies hook to ad 'mf_useformat' cookie to 
x-vary-options

Modified Paths:
--------------
    trunk/extensions/MobileFrontend/MobileFrontend.body.php
    trunk/extensions/MobileFrontend/MobileFrontend.php
    trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php

Modified: trunk/extensions/MobileFrontend/MobileFrontend.body.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.body.php     2012-03-19 
23:14:49 UTC (rev 114210)
+++ trunk/extensions/MobileFrontend/MobileFrontend.body.php     2012-03-19 
23:19:35 UTC (rev 114211)
@@ -1503,6 +1503,11 @@
                return $expiry;
        }
        
+       public function getCacheVaryCookies( $out, &$cookies ) {
+               global $wgCookiePrefix;
+               $cookies[] = $wgCookiePrefix . 'mf_useformat';
+       }
+       
        /**
         * Determine the duration the cookie should last.
         * 

Modified: trunk/extensions/MobileFrontend/MobileFrontend.php
===================================================================
--- trunk/extensions/MobileFrontend/MobileFrontend.php  2012-03-19 23:14:49 UTC 
(rev 114210)
+++ trunk/extensions/MobileFrontend/MobileFrontend.php  2012-03-19 23:19:35 UTC 
(rev 114211)
@@ -121,6 +121,8 @@
  */
 $wgMobileRedirectFormAction = false;
 
+$wgMobileResourceVersion;
+
 $wgExtMobileFrontend = null;
 
 $wgExtensionFunctions[] = 'efMobileFrontend_Setup';
@@ -134,6 +136,7 @@
 $wgHooks['APIGetDescription'][] = 'ApiParseExtender::onAPIGetDescription';
 $wgHooks['OpenSearchXml'][] = 'ApiQueryExtracts::onOpenSearchXml';
 
+
 function efMobileFrontend_Setup() {
        global $wgExtMobileFrontend, $wgHooks;
        $wgExtMobileFrontend = new ExtMobileFrontend();
@@ -142,6 +145,7 @@
        $wgHooks['SkinTemplateOutputPageBeforeExec'][] = array( 
&$wgExtMobileFrontend, 'addMobileFooter' );
        $wgHooks['TestCanonicalRedirect'][] = array( &$wgExtMobileFrontend, 
'testCanonicalRedirect' );
        $wgHooks['ResourceLoaderTestModules'][] = array( &$wgExtMobileFrontend, 
'addTestModules' );
+       $wgHooks['GetCacheVaryCookies'][] = array( &$wgExtMobileFrontend, 
'getCacheVaryCookies' );
 }
 
 /**

Modified: trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php
===================================================================
--- trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php   
2012-03-19 23:14:49 UTC (rev 114210)
+++ trunk/extensions/MobileFrontend/templates/ApplicationTemplate.php   
2012-03-19 23:19:35 UTC (rev 114211)
@@ -7,7 +7,7 @@
 class ApplicationTemplate extends MobileFrontendTemplate {
 
        public function getHTML() {
-
+               global $wgMobileResourceVersion;
                if ( $this->data['wgAppleTouchIcon'] !== false ) {
                        $appleTouchIconTag = Html::element( 'link', array( 
'rel' => 'apple-touch-icon', 'href' => $this->data['wgAppleTouchIcon'] ) );
                } else {
@@ -36,7 +36,7 @@
 
                $jQuerySupport = $this->data['device']['supports_jquery'];
                $jQueryScript = $jQuerySupport ? $startScriptTag . 
$javaScriptPath . 'jquery-1.7.1.min.js' . $endScriptTag : '';
-               $filePageScript = ( $this->data['isFilePage'] ) ? 
$startScriptTag . $javaScriptPath . 'filepage.js?version=1332193250' . 
$endScriptTag : '';
+               $filePageScript = ( $this->data['isFilePage'] ) ? 
$startScriptTag . $javaScriptPath . 'filepage.js?version=' . 
$wgMobileResourceVersion . $endScriptTag : '';
 
                $startLinkTag = "<link 
href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/";
                $endLinkTag = "' media='all' rel='Stylesheet' type='text/css' 
/>";
@@ -59,7 +59,7 @@
 
                if( $this->data['isBetaGroupMember'] && $jQuerySupport ) {
                        $betajs = <<<HTML
-                       
{$startScriptTag}{$javaScriptPath}references.{$resourceSuffix}js?version=1332193250{$endScriptTag}
+                       
{$startScriptTag}{$javaScriptPath}references.{$resourceSuffix}js?version={$wgMobileResourceVersion}{$endScriptTag}
 HTML;
                } else {
                        $betajs = "";
@@ -71,8 +71,8 @@
                  <head>
                        <title>{$this->data['htmlTitle']}</title>
                        <meta http-equiv="content-type" 
content="application/xhtml+xml; charset=utf-8" />
-                       <link 
href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version=1332193250'
 media='all' rel='Stylesheet' type='text/css' />
-                       <link 
href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version=1332193250'
 media='all' rel='Stylesheet' type='text/css' />
+                       <link 
href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$betaPrefix}common.css?version={$wgMobileResourceVersion}'
 media='all' rel='Stylesheet' type='text/css' />
+                       <link 
href='{$this->data['wgExtensionAssetsPath']}/MobileFrontend/stylesheets/{$cssFileName}.css?version={$wgMobileResourceVersion}'
 media='all' rel='Stylesheet' type='text/css' />
                        {$filePageStyle}
                        <meta name="viewport" content="initial-scale=1.0">
                        {$appleTouchIconTag}


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to