From: Bryan Tong Minh Date: Fri, 2 Jul 2010 19:54:46 +0000 (+0000) Subject: (bug 24212) Added MediaWiki:ImagePage.css which is also included on foreign client... X-Git-Tag: 1.31.0-rc.0~36297 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=3136686db6028c95ad17ac210b9bcbe5e7507fb3;p=lhc%2Fweb%2Fwiklou.git (bug 24212) Added MediaWiki:ImagePage.css which is also included on foreign client wikis. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 70ca062076..2060f26d78 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -100,6 +100,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * texvc now supports \bcancel and \xcancel in addition to \cancel and \cancelto * Added scriptExtension setting to $wgForeignFileRepos * ForeignApiRepo uses scriptDirUrl if apiBase not set +* (bug 24212) Added MediaWiki:ImagePage.css which is also included on foreign + client wikis. === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive diff --git a/includes/ImagePage.php b/includes/ImagePage.php index a696755fbd..001d84dcc3 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -152,6 +152,11 @@ class ImagePage extends Article { $wgOut->addHTML( "\n" ); } + + $css = $this->repo->getDescriptionStylesheetUrl(); + if ( $css ) { + $wgOut->addStyle( $css ); + } } public function getRedirectTarget() { diff --git a/includes/Setup.php b/includes/Setup.php index 91964bea9f..77832a1eda 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -84,6 +84,8 @@ if ( !$wgLocalFileRepo ) { 'class' => 'LocalRepo', 'name' => 'local', 'directory' => $wgUploadDirectory, + 'scriptDirUrl' => $wgScriptPath, + 'scriptExtension' => $wgScriptExtension, 'url' => $wgUploadBaseUrl ? $wgUploadBaseUrl . $wgUploadPath : $wgUploadPath, 'hashLevels' => $wgHashedUploadDirectory ? 2 : 0, 'thumbScriptUrl' => $wgThumbnailScriptPath, diff --git a/includes/Skin.php b/includes/Skin.php index ab34b33a8a..9495c07385 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -616,11 +616,7 @@ CSS; // Per-site custom styles if( $wgUseSiteCss ) { global $wgHandheldStyle; - $query = wfArrayToCGI( array( - 'usemsgcache' => 'yes', - 'ctype' => 'text/css', - 'smaxage' => $wgSquidMaxage - ) + $siteargs ); + $query = wfArrayToCGI( self::getDynamicStylesheetQuery() ); # Site settings must override extension css! (bug 15025) $out->addStyle( self::makeNSUrl( 'Common.css', $query, NS_MEDIAWIKI ) ); $out->addStyle( self::makeNSUrl( 'Print.css', $query, NS_MEDIAWIKI ), 'print' ); @@ -666,6 +662,22 @@ CSS; wfProfileOut( __METHOD__ ); } + + /** + * Get the query to generate a dynamic stylesheet + * + * @return array + */ + public static function getDynamicStylesheetQuery() { + global $wgSquidMaxage; + return array( + 'action' => 'raw', + 'maxage' => $wgSquidMaxage, + 'usemsgcache' => 'yes', + 'ctype' => 'text/css', + 'smaxage' => $wgSquidMaxage, + ); + } /** * Add skin specific stylesheets diff --git a/includes/filerepo/FileRepo.php b/includes/filerepo/FileRepo.php index e5ea48df55..6229896e77 100644 --- a/includes/filerepo/FileRepo.php +++ b/includes/filerepo/FileRepo.php @@ -372,6 +372,17 @@ abstract class FileRepo { } } } + + /** + * Get the URL of the stylesheet to apply to description pages + * @return string + */ + function getDescriptionStylesheetUrl() { + if ( $this->scriptDirUrl ) { + return self::makeUrl( 'title=MediaWiki:ImagePage.css&' . + wfArrayToCGI( Skin::getDynamicStylesheetQuery() ) ); + } + } /** * Store a file to a given destination.