Add $version parameter for custom style versions to OutputPage::addScriptFile() so...
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 4 Jun 2010 19:13:16 +0000 (19:13 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 4 Jun 2010 19:13:16 +0000 (19:13 +0000)
includes/OutputPage.php

index ed46978..9722be8 100644 (file)
@@ -183,15 +183,18 @@ class OutputPage {
         *
         * @param $file String: filename in skins/common or complete on-server path
         *              (/foo/bar.js)
+        * @param $version String: style version of the file. Defaults to $wgStyleVersion
         */
-       public function addScriptFile( $file ) {
+       public function addScriptFile( $file, $version = null ) {
                global $wgStylePath, $wgStyleVersion;
                if( substr( $file, 0, 1 ) == '/' || preg_match( '#^[a-z]*://#i', $file ) ) {
                        $path = $file;
                } else {
                        $path = "{$wgStylePath}/common/{$file}";
                }
-               $this->addScript( Html::linkedScript( wfAppendQuery( $path, $wgStyleVersion ) ) );
+               if ( is_null( $version ) )
+                       $version = $wgStyleVersion;
+               $this->addScript( Html::linkedScript( wfAppendQuery( $path, $version ) ) );
        }
 
        /**