* (bug 6868) Un-hardcode section edit link style
* (bug 3205) Stop right floats from stacking horizontally in non-Monobook skins
* (bug 2013) Inherit ratios and not computed values for line-height
+* Added global $wgStyleVersion to centralize bumping CSS and JS file versions
+ for cache-friendly style and script updating
+
== Languages updated ==
*/
$wgCacheEpoch = '20030516000000';
+/**
+ * Bump this number when changing the global style sheets and JavaScript.
+ * It should be appended in the query string of static CSS and JS includes,
+ * to ensure that client-side caches don't keep obsolete copies of global
+ * styles.
+ */
+$wgStyleVersion = '11';
# Server-side caching:
* of the preview button
*/
function doLivePreviewScript() {
- global $wgStylePath, $wgJsMimeType, $wgOut, $wgTitle;
+ global $wgStylePath, $wgJsMimeType, $wgStyleVersion, $wgOut, $wgTitle;
$wgOut->addHTML( '<script type="'.$wgJsMimeType.'" src="' .
- htmlspecialchars( $wgStylePath . '/common/preview.js' ) .
+ htmlspecialchars( "$wgStylePath/common/preview.js?$wgStyleVersion" ) .
'"></script>' . "\n" );
$liveAction = $wgTitle->getLocalUrl( 'action=submit&wpPreview=true&live=true' );
return "return !livePreview(" .
* @private
*/
function outXmlHeader() {
- global $wgServer, $wgStylePath;
+ global $wgServer, $wgStylePath, $wgStyleVersion;
$this->httpHeaders();
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo '<?xml-stylesheet type="text/css" href="' .
- htmlspecialchars( "$wgServer$wgStylePath/common/feed.css" ) . '"?' . ">\n";
+ htmlspecialchars( "$wgServer$wgStylePath/common/feed.css?$wgStyleVersion" ) . '"?' . ">\n";
}
}
$this->imageHistory();
$this->imageLinks();
if( $exif ) {
- global $wgStylePath;
+ global $wgStylePath, $wgStyleVersion;
$expand = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-expand' ) ) );
$collapse = htmlspecialchars( wfEscapeJsString( wfMsg( 'metadata-collapse' ) ) );
$wgOut->addHTML( "<h2 id=\"metadata\">" . wfMsgHtml( 'metadata' ) . "</h2>\n" );
$wgOut->addWikiText( $this->makeMetadataTable( $exif ) );
$wgOut->addHTML(
- "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js\"></script>\n" .
+ "<script type=\"text/javascript\" src=\"$wgStylePath/common/metadata.js?wgStyleVersion\"></script>\n" .
"<script type=\"text/javascript\">attachMetadataToggle('mw_metadata', '$expand', '$collapse');</script>\n" );
}
} else {
global $wgUser, $wgOutputEncoding, $wgRequest;
global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType;
global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgScriptPath, $wgServer;
+ global $wgStyleVersion;
if( $this->mDoNothing ){
return;
$sk = $wgUser->getSkin();
if ( $wgUseAjax ) {
- $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js\"></script>\n" );
+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js?$wgStyleVersion\"></script>\n" );
}
if ( $wgUseAjax && $wgAjaxSearch ) {
- $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js\"></script>\n" );
+ $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js?$wgStyleVersion\"></script>\n" );
$this->addScript( "<script type=\"{$wgJsMimeType}\">hookEvent(\"load\", sajax_onload);</script>\n" );
}
*/
function headElement() {
global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
- global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle;
+ global $wgUser, $wgContLang, $wgUseTrackbacks, $wgTitle, $wgStyleVersion;
if( $wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml' ) {
$ret = "<?xml version=\"1.0\" encoding=\"$wgOutputEncoding\" ?>\n";
} else {
$media = "media='print'";
}
- $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css" );
+ $printsheet = htmlspecialchars( "$wgStylePath/common/wikiprintable.css?$wgStyleVersion" );
$ret .= "<link rel='stylesheet' type='text/css' $media href='$printsheet' />\n";
$sk = $wgUser->getSkin();
}
function buildScript() {
- global $wgStylePath;
+ global $wgStylePath, $wgStyleVersion;
return '<script type="text/javascript" src="' .
- htmlspecialchars( $wgStylePath . "/common/protect.js" ) .
+ htmlspecialchars( $wgStylePath . "/common/protect.js?$wgStyleVersion" ) .
'"></script>';
}
/** @return string path to the skin stylesheet */
function getStylesheet() {
- return 'common/wikistandard.css?2';
+ return 'common/wikistandard.css';
}
/** @return string skin name */
}
function getHeadScripts() {
- global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType;
+ global $wgStylePath, $wgUser, $wgAllowUserJs, $wgJsMimeType, $wgStyleVersion;
global $wgArticlePath, $wgScriptPath, $wgServer, $wgContLang, $wgLang;
global $wgTitle, $wgCanonicalNamespaceNames, $wgOut;
$r = self::makeGlobalVariablesScript( $vars );
- $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js\"></script>\n";
+ $r .= "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/wikibits.js?$wgStyleVersion\"></script>\n";
if( $wgAllowUserJs && $wgUser->isLoggedIn() ) {
$userpage = $wgUser->getUserPage();
$userjs = htmlspecialchars( self::makeUrl(
# get the user/site-specific stylesheet, SkinTemplate loads via RawPage.php (settings are cached that way)
function getUserStylesheet() {
- global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage;
+ global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
$sheet = $this->getStylesheet();
$action = $wgRequest->getText('action');
- $s = "@import \"$wgStylePath/$sheet\";\n";
+ $s = "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?1\";\n";
$query = "usemsgcache=yes&action=raw&ctype=text/css&smaxage=$wgSquidMaxage";
$siteargs .= '&ts=' . $wgUser->mTouched;
}
- if ($wgContLang->isRTL()) $sitecss .= '@import "' . $wgStylePath . '/' . $this->stylename . '/rtl.css?1";' . "\n";
+ if( $wgContLang->isRTL() ) {
+ global $wgStyleVersion;
+ $sitecss .= "@import \"$wgStylePath/$this->stylename/rtl.css?$wgStyleVersion\";\n";
+ }
# If we use the site's dynamic CSS, throw that in, too
if ( $wgUseSiteCss ) {
class SkinCologneBlue extends Skin {
function getStylesheet() {
- return "common/cologneblue.css?4";
+ return 'common/cologneblue.css';
}
function getSkinName() {
return "cologneblue";
<meta http-equiv="Content-Type" content="<?php $this->text('mimetype') ?>; charset=<?php $this->text('charset') ?>" />
<?php $this->html('headlinks') ?>
<title><?php $this->text('pagetitle') ?></title>
- <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?10"; /*]]>*/</style>
- <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css?1" />
- <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css";</style><![endif]-->
- <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css";</style><![endif]-->
- <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css";</style><![endif]-->
- <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?1";</style><![endif]-->
- <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js"></script>
+ <style type="text/css" media="screen,projection">/*<![CDATA[*/ @import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/main.css?<?php echo $GLOBALS['wgStyleVersion'] ?>"; /*]]>*/</style>
+ <link rel="stylesheet" type="text/css" <?php if(empty($this->data['printable']) ) { ?>media="print"<?php } ?> href="<?php $this->text('stylepath') ?>/common/commonPrint.css?<?php echo $GLOBALS['wgStyleVersion'] ?>" />
+ <!--[if lt IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE50Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
+ <!--[if IE 5.5000]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE55Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
+ <!--[if IE 6]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE60Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
+ <!--[if IE 7]><style type="text/css">@import "<?php $this->text('stylepath') ?>/<?php $this->text('stylename') ?>/IE70Fixes.css?<?php echo $GLOBALS['wgStyleVersion'] ?>";</style><![endif]-->
+ <!--[if lt IE 7]><script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath') ?>/common/IEFixes.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"></script>
<meta http-equiv="imagetoolbar" content="no" /><![endif]-->
<?php print Skin::makeGlobalVariablesScript( $this->data ); ?>
- <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?2"><!-- wikibits js --></script>
+ <script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('stylepath' ) ?>/common/wikibits.js?<?php echo $GLOBALS['wgStyleVersion'] ?>"><!-- wikibits js --></script>
<?php if($this->data['jsvarurl' ]) { ?>
<script type="<?php $this->text('jsmimetype') ?>" src="<?php $this->text('jsvarurl' ) ?>"><!-- site js --></script>
<?php } ?>
class SkinNostalgia extends Skin {
function getStylesheet() {
- return 'common/nostalgia.css?2';
+ return 'common/nostalgia.css';
}
function getSkinName() {
return "nostalgia";
*
*/
function getHeadScripts() {
- global $wgStylePath, $wgJsMimeType;
+ global $wgStylePath, $wgJsMimeType, $wgStyleVersion;
$s = parent::getHeadScripts();
if ( 3 == $this->qbSetting() ) { # Floating left
$s .= "<script language='javascript' type='$wgJsMimeType' " .
- "src='{$wgStylePath}/common/sticky.js'></script>\n";
+ "src='{$wgStylePath}/common/sticky.js?$wgStyleVersion'></script>\n";
}
return $s;
}
*
*/
function getUserStyles() {
- global $wgStylePath;
+ global $wgStylePath, $wgStyleVersion;
$s = '';
if ( 3 == $this->qbSetting() ) { # Floating left
$s .= "<style type='text/css'>\n" .
- "@import '{$wgStylePath}/common/quickbar.css';\n</style>\n";
+ "@import '{$wgStylePath}/common/quickbar.css?$wgStyleVersion';\n</style>\n";
} else if ( 4 == $this->qbSetting() ) { # Floating right
$s .= "<style type='text/css'>\n" .
- "@import '{$wgStylePath}/common/quickbar-right.css';\n</style>\n";
+ "@import '{$wgStylePath}/common/quickbar-right.css?$wgStyleVersion';\n</style>\n";
}
$s .= parent::getUserStyles();
return $s;