http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70607

Revision: 70607
Author:   siebrand
Date:     2010-08-06 23:40:27 +0000 (Fri, 06 Aug 2010)

Log Message:
-----------
Remove version checks for some outdated versions of MediaWiki (1.11 and 
earlier).

Modified Paths:
--------------
    trunk/extensions/ContactPageFundraiser/SpecialContact.php
    trunk/extensions/ContributionScores/ContributionScores.php
    trunk/extensions/ContributionScores/ContributionScores_body.php
    trunk/extensions/Contributors/Contributors.page.php
    trunk/extensions/CountEdits/CountEdits.page.php
    trunk/extensions/DynamicPageList/DynamicPageListInclude.php
    trunk/extensions/EmbedVideo/EmbedVideo.hooks.php
    trunk/extensions/EmbedVideo/EmbedVideo.php
    trunk/extensions/GoogleMaps/GoogleMaps.php
    trunk/extensions/LabeledSectionTransclusion/lst.php
    trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
    trunk/extensions/NewsChannel/NewsChannel_body.php
    trunk/extensions/SmoothGallery/SmoothGalleryClass.php
    trunk/extensions/StalePages/StalePages_body.php

Modified: trunk/extensions/ContactPageFundraiser/SpecialContact.php
===================================================================
--- trunk/extensions/ContactPageFundraiser/SpecialContact.php   2010-08-06 
23:10:31 UTC (rev 70606)
+++ trunk/extensions/ContactPageFundraiser/SpecialContact.php   2010-08-06 
23:40:27 UTC (rev 70607)
@@ -325,11 +325,7 @@
 
                        wfDebug( "$fname: sending mail from 
".$from->toString()." to ".$to->toString()." replyto 
".($replyto==null?'-/-':$replyto->toString())."\n" );
 
-                       #HACK: in MW 1.9, replyto must be a string, in MW 1.10 
it must be an object!
-                       $ver = preg_replace( '![^\d._+]!', '', 
$GLOBALS['wgVersion'] );
-                       $replyaddr = $replyto == null
-                                       ? null : version_compare( $ver, '1.10', 
'<' )
-                                               ? $replyto->toString() : 
$replyto;
+                       $replyaddr = $replyto == null ? null : $replyto;
 
                        $mailResult = userMailer( $to, $from, $subject, 
$this->text, $replyaddr );
 

Modified: trunk/extensions/ContributionScores/ContributionScores.php
===================================================================
--- trunk/extensions/ContributionScores/ContributionScores.php  2010-08-06 
23:10:31 UTC (rev 70606)
+++ trunk/extensions/ContributionScores/ContributionScores.php  2010-08-06 
23:40:27 UTC (rev 70607)
@@ -33,28 +33,13 @@
 if( version_compare( $wgVersion, '1.13', '>=' ) ) {
        $wgExtensionMessagesFiles['ContributionScores'] = 
CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php';
        $wgExtensionAliasesFiles['ContributionScores'] = 
CONTRIBUTIONSCORES_PATH . '/ContributionScores.alias.php';
-} else if( version_compare( $wgVersion, '1.11', '>=' ) ) {
        $wgExtensionMessagesFiles['ContributionScores'] = 
CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php';
-} else {
-       $wgExtensionFunctions[] = 'efContributionScores_AddMessages';
 }
 
 $wgHooks['LanguageGetMagic'][] = 'efContributionScores_LanguageGetMagic';
 
 $wgHooks['ParserFirstCallInit'][] = 'efContributionScores_Setup';
 
-///Message Cache population for versions that did not support 
$wgExtensionFunctions
-function efContributionScores_AddMessages() {
-       global $wgMessageCache;
-
-       #Add Messages
-       require( CONTRIBUTIONSCORES_PATH . '/ContributionScores.i18n.php' );
-       foreach( $messages as $key => $value ) {
-                 $wgMessageCache->addMessages( $messages[$key], $key );
-       }
-       return true;
-}
-
 function efContributionScores_Setup( &$parser ) {
        $parser->setFunctionHook( 'cscore', 'efContributionScores_Render' );
        return true;
@@ -66,10 +51,9 @@
 }
 
 function efContributionScores_Render(&$parser, $usertext, $metric='score') {
-       global $wgContribScoreDisableCache, $wgVersion;
+       global $wgContribScoreDisableCache;
 
-       if( version_compare( $wgVersion, '1.11', '>=' ) )
-               wfLoadExtensionMessages( 'ContributionScores' );
+       wfLoadExtensionMessages( 'ContributionScores' );
 
        $output = "";
 

Modified: trunk/extensions/ContributionScores/ContributionScores_body.php
===================================================================
--- trunk/extensions/ContributionScores/ContributionScores_body.php     
2010-08-06 23:10:31 UTC (rev 70606)
+++ trunk/extensions/ContributionScores/ContributionScores_body.php     
2010-08-06 23:40:27 UTC (rev 70607)
@@ -138,10 +138,9 @@
        }
 
        function execute( $par ) {
-               global $wgRequest, $wgVersion, $wgOut, $wgHooks;
+               global $wgRequest, $wgOut, $wgHooks;
                
-               if( version_compare( $wgVersion, '1.11', '>=' ) )
-                       wfLoadExtensionMessages( 'ContributionScores' );
+               wfLoadExtensionMessages( 'ContributionScores' );
                
                $this->setHeaders();
 

Modified: trunk/extensions/Contributors/Contributors.page.php
===================================================================
--- trunk/extensions/Contributors/Contributors.page.php 2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/Contributors/Contributors.page.php 2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -178,10 +178,8 @@
         * @return array
         */
        protected static function getConditions($title) {
-               global $wgVersion;
                $conds['rev_page'] = $title->getArticleId();
-               if( version_compare( $wgVersion, '1.11alpha', '>=' ) )
-                       $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . 
' = 0';
+               $conds[] = 'rev_deleted & ' . Revision::DELETED_USER . ' = 0';
                return $conds;
        }
        

Modified: trunk/extensions/CountEdits/CountEdits.page.php
===================================================================
--- trunk/extensions/CountEdits/CountEdits.page.php     2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/CountEdits/CountEdits.page.php     2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -62,11 +62,9 @@
        }
 
        function countEditsReal( $id, $text = false ) {
-               global $wgVersion;
                $dbr = wfGetDB( DB_SLAVE );
-               # MediaWiki 1.9.x has a user.user_editcount column we can use,
-               # but this is not useful for older versions or anon. checks
-               if( $text === false && version_compare( $wgVersion, '1.9alpha', 
'>=' ) ) {
+
+               if( $text === false ) {
                        $conds = array( 'user_id' => $id );
                        return $dbr->selectField( 'user', 'user_editcount', 
$conds, 'CountEdits::countEditsReal' );
                } else {

Modified: trunk/extensions/DynamicPageList/DynamicPageListInclude.php
===================================================================
--- trunk/extensions/DynamicPageList/DynamicPageListInclude.php 2010-08-06 
23:10:31 UTC (rev 70606)
+++ trunk/extensions/DynamicPageList/DynamicPageListInclude.php 2010-08-06 
23:40:27 UTC (rev 70607)
@@ -135,8 +135,6 @@
                $recursionCheck = true, $maxLength = - 1, $link = '',
                $trim = false, $skipPattern = array()
        ) {
-               global $wgVersion;
-
                // if someone tries something like<section begin=blah>lst 
only</section>
                // text, may as well do the right thing.
                $text = str_replace( '</section>', '', $text );
@@ -147,10 +145,8 @@
                }
 
                if ( self::open( $parser, $part1 ) ) {
-                       // Handle recursion here, so we can break cycles.  
Although we can't do
-                       // feature detection here, r18473 was only a few weeks 
before the
-                       // release, so this is close enough.
-                       if ( version_compare( $wgVersion, '1.9' ) < 0 || 
$recursionCheck == false ) {
+                       // Handle recursion here, so we can break cycles.
+                       if ( $recursionCheck == false ) {
                                $text = $parser->preprocess( $text, 
$parser->mTitle, $parser->mOptions );
                                self::close( $parser, $part1 );
                        }

Modified: trunk/extensions/EmbedVideo/EmbedVideo.hooks.php
===================================================================
--- trunk/extensions/EmbedVideo/EmbedVideo.hooks.php    2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/EmbedVideo/EmbedVideo.hooks.php    2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -15,9 +15,7 @@
        public static function setup() {
                # Setup parser hooks. ev is the primary hook, evp is supported 
for
                # legacy purposes
-               global $wgVersion;
-
-               $prefix = version_compare( $wgVersion, '1.7', '<' ) ? '#' : '';
+               $prefix = '';
                EmbedVideo::addMagicWord( $prefix, "ev", 
"EmbedVideo::parserFunction_ev" );
                EmbedVideo::addMagicWord( $prefix, "evp", 
"EmbedVideo::parserFunction_evp" );
 

Modified: trunk/extensions/EmbedVideo/EmbedVideo.php
===================================================================
--- trunk/extensions/EmbedVideo/EmbedVideo.php  2010-08-06 23:10:31 UTC (rev 
70606)
+++ trunk/extensions/EmbedVideo/EmbedVideo.php  2010-08-06 23:40:27 UTC (rev 
70607)
@@ -33,13 +33,5 @@
 $wgExtensionMessagesFiles['embedvideo'] = $dir . 'EmbedVideo.i18n.php';
 
 $wgHooks['ParserFirstCallInit'][] = "EmbedVideo::setup";
-if ( version_compare( $wgVersion, '1.7', '<' ) ) {
-       # Hack solution to resolve 1.6 array parameter nullification for hook 
args
-       function wfEmbedVideoLanguageGetMagic( &$magicWords ) {
-               EmbedVideo::parserFunctionMagic( $magicWords );
-               return true;
-       }
-       $wgHooks['LanguageGetMagic'][] = 'wfEmbedVideoLanguageGetMagic';
-} else {
-       $wgHooks['LanguageGetMagic'][] = 'EmbedVideo::parserFunctionMagic';
-}
+$wgHooks['LanguageGetMagic'][] = 'EmbedVideo::parserFunctionMagic';
+

Modified: trunk/extensions/GoogleMaps/GoogleMaps.php
===================================================================
--- trunk/extensions/GoogleMaps/GoogleMaps.php  2010-08-06 23:10:31 UTC (rev 
70606)
+++ trunk/extensions/GoogleMaps/GoogleMaps.php  2010-08-06 23:40:27 UTC (rev 
70607)
@@ -26,28 +26,6 @@
 require( 'extensions/GoogleMaps/SpecialGoogleMapsKML.php' );
 require( 'extensions/GoogleMaps/GoogleMaps.body.php' );
 
-/**
- * This function is for rendering a <googlemap> tag on MW 1.5.
- * It cannot be an object function. (Compare to the render16 function
- * of the GoogleMaps class.)
- *
- * @param $pContent string - the content of the <googlemap> tag
- * @param $pArgv array - an array of attribute name/value pairs for the
- *  tag
- *
- * @return string - the HTML string to output for the <googlemap> tag
- **/
-function wfGoogleMaps_Render15 ( $pContent, $pArgv ) {
-       global $wgGoogleMaps, $wgParser;
-       // get the global parser and pass through to the main render function
-       return $wgGoogleMaps->render( $pContent, $pArgv, $wgParser, $wgParser );
-}
-
-function wfGoogleMaps_RenderKmlLink15 ( $pContent, $pArgv ) {
-       global $wgGoogleMaps;
-       return $wgGoogleMaps->renderKmlLink( $pContent, $pArgv );
-}
-
 function wfGoogleMaps_CommentJS(&$pParser, &$pText) {
     global $wgGoogleMaps;
     return $wgGoogleMaps->commentJS($pParser, $pText);
@@ -64,7 +42,7 @@
        global $wgGoogleMapsKey, $wgGoogleMapsKeys, 
$wgGoogleMapsDisableEditorsMap, $wgGoogleMapsEnablePaths,
                $wgGoogleMapsDefaults, $wgGoogleMapsMessages, 
$wgGoogleMapsCustomMessages, $wgGoogleMapsUrlPath,
                $wgXhtmlNamespaces, $wgGoogleMapsTemplateVariables, 
$wgJsMimeType, $wgLanguageCode, $wgContLang,
-               $wgParser, $wgProxyKey, $wgVersion, $wgGoogleMaps, $wgHooks, 
$wgScriptPath, $wgSpecialPages,
+               $wgParser, $wgProxyKey, $wgGoogleMaps, $wgHooks, $wgScriptPath, 
$wgSpecialPages,
                $wgTitle;
        // set up some default values for the various extension configuration 
parameters
        // to keep from getting PHP notices if running in strict mode
@@ -118,11 +96,7 @@
 
        // add the google mime types
        $magic = null;
-       if( version_compare( $wgVersion, "1.8" ) >= 0 ) {
-               $magic = MimeMagic::singleton( );
-       } else {
-               $magic = wfGetMimeMagic( );
-       }
+       $magic = MimeMagic::singleton( );
        $magic->mExtToMime['kml'] = 'application/vnd.google-earth.kml+xml';
        $magic->mExtToMime['kmz'] = 'application/vnd.google-earth.kmz';
 
@@ -142,16 +116,13 @@
                $wgTitle );
 
        // This hook will add the interactive editing map to the article edit 
page.
-       // This hook was introduced in MW 1.6
         $editHook = array( $wgGoogleMaps, 'editForm' );
-       if( version_compare( $wgVersion, "1.6" ) >= 0 ) {
-               if( !$wgGoogleMapsDisableEditorsMap ) {
-                       if( isset( $wgHooks['EditPage::showEditForm:initial'] )
-                               && is_array( 
$wgHooks['EditPage::showEditForm:initial'] ) ) {
-                                       array_unshift( 
$wgHooks['EditPage::showEditForm:initial'], $editHook );
-                       } else {
-                               $wgHooks['EditPage::showEditForm:initial'] = 
array( $editHook );
-                       }
+       if( !$wgGoogleMapsDisableEditorsMap ) {
+               if( isset( $wgHooks['EditPage::showEditForm:initial'] )
+                       && is_array( $wgHooks['EditPage::showEditForm:initial'] 
) ) {
+                               array_unshift( 
$wgHooks['EditPage::showEditForm:initial'], $editHook );
+               } else {
+                       $wgHooks['EditPage::showEditForm:initial'] = array( 
$editHook );
                }
        }
 
@@ -167,13 +138,8 @@
        // This hook will be called any time the parser encounters a <googlemap>
        // tag in an article.  This will render the actual Google map code in
        // the article.
-       if( version_compare( $wgVersion, "1.6" ) >= 0 ) {
-               $wgParser->setHook( 'googlemap', array( $wgGoogleMaps, 
'render16' ) );
-               $wgParser->setHook( 'googlemapkml', array( $wgGoogleMaps, 
'renderKmlLink' ) );
-       } else {
-               $wgParser->setHook( 'googlemap', 'wfGoogleMaps_Render15' );
-               $wgParser->setHook( 'googlemapkml', 
'wfGoogleMaps_RenderKmlLink15' );
-       }
+       $wgParser->setHook( 'googlemap', array( $wgGoogleMaps, 'render16' ) );
+       $wgParser->setHook( 'googlemapkml', array( $wgGoogleMaps, 
'renderKmlLink' ) );
 
        // Set up the special page
        $wgSpecialPages['GoogleMapsKML'] = array('GoogleMapsKML', 
'GoogleMapsKML');

Modified: trunk/extensions/LabeledSectionTransclusion/lst.php
===================================================================
--- trunk/extensions/LabeledSectionTransclusion/lst.php 2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/LabeledSectionTransclusion/lst.php 2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -137,13 +137,6 @@
     $text = str_replace('</section>', '', $text);
 
     if (self::open_($parser, $part1)) {
-      //Handle recursion here, so we can break cycles.
-      global $wgVersion;
-      if( version_compare( $wgVersion, "1.9" ) < 0 ) {
-        $text = $parser->replaceVariables($text);
-        self::close_($parser, $part1);
-      }
-      
       //Try to get edit sections correct by munging around the parser's guts.
       return array($text, 'title'=>$title, 'replaceHeadings'=>true, 
            'headingOffset'=>$skiphead, 'noparse'=>false, 'noargs'=>false);

Modified: trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php
===================================================================
--- trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php        
2010-08-06 23:10:31 UTC (rev 70606)
+++ trunk/extensions/MetavidWiki/includes/MV_GlobalFunctions.php        
2010-08-06 23:40:27 UTC (rev 70607)
@@ -433,30 +433,9 @@
  * Function based on version in ContributionScores extension
  */
 function mvfInitMessages() {
-       global $wgVersion, $wgExtensionFunctions;
-       if ( version_compare( $wgVersion, '1.11', '>=' ) ) {
-               wfLoadExtensionMessages( 'MetavidWiki' );
-       } else {
-               $wgExtensionFunctions[] = 'sffLoadMessagesManually';
-       }
+       wfLoadExtensionMessages( 'MetavidWiki' );
 }
 
-/**
- * Setting of message cache for versions of MediaWiki that do not support
- * wgExtensionFunctions - based on ceContributionScores() in
- * ContributionScores extension
- */
-function sffLoadMessagesManually() {
-       global $mvgIP, $wgMessageCache;
-
-       # add messages
-       require( $mvgIP . '/languages/MV_Messages.php' );
-       global $messages;
-       foreach ( $messages as $key => $value ) {
-               $wgMessageCache->addMessages( $messages[$key], $key );
-       }
-}
-
 /*
  * Utility functions:
  */

Modified: trunk/extensions/NewsChannel/NewsChannel_body.php
===================================================================
--- trunk/extensions/NewsChannel/NewsChannel_body.php   2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/NewsChannel/NewsChannel_body.php   2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -37,16 +37,10 @@
         * @param string $par Custom parameters.
         */
        function execute( $par ) {
-               global $wgRequest, $wgVersion, $wgOut, $wgNewsChannelCategory, 
$wgNewsChannelDefaultItems;
+               global $wgRequest, $wgOut, $wgNewsChannelCategory, 
$wgNewsChannelDefaultItems;
 
                wfLoadExtensionMessages( 'NewsChannel' );
 
-               if( version_compare( $wgVersion, '1.8', '<' ) === true ) {
-                       $wgOut->showErrorPage( "Error: Upgrade required", "The 
News Channel extension can't work " .
-                               "on MediaWiki older than 1.8. Please, upgrade." 
);
-                       return;
-               }
-
                if( $wgNewsChannelCategory == '' || $wgNewsChannelCategory == 
null ) {
                        $wgOut->showErrorPage( "Error: Misconfiguration", "Main 
category containing news articles " .
                                "was not defined for News Channel extension. 
Please, define it." );

Modified: trunk/extensions/SmoothGallery/SmoothGalleryClass.php
===================================================================
--- trunk/extensions/SmoothGallery/SmoothGalleryClass.php       2010-08-06 
23:10:31 UTC (rev 70606)
+++ trunk/extensions/SmoothGallery/SmoothGalleryClass.php       2010-08-06 
23:40:27 UTC (rev 70607)
@@ -195,11 +195,8 @@
                                continue;
                        }
 
-                       if ( version_compare( $wgVersion, "1.11", '<' ) ) {
-                               $plain_gallery->add( $image["image_object"], 
$image["description"] ); // TODO: use text
-                       } else {
-                               $plain_gallery->add( 
$image["image_object"]->getTitle(), $image["description"] ); // TODO: use text
-                       }
+                       $plain_gallery->add( 
$image["image_object"]->getTitle(), $image["description"] ); // TODO: use text
+
                        $i++;
                }
 

Modified: trunk/extensions/StalePages/StalePages_body.php
===================================================================
--- trunk/extensions/StalePages/StalePages_body.php     2010-08-06 23:10:31 UTC 
(rev 70606)
+++ trunk/extensions/StalePages/StalePages_body.php     2010-08-06 23:40:27 UTC 
(rev 70607)
@@ -24,9 +24,7 @@
        }
 
        function execute( $parameters ) {
-               global $wgVersion;
-               if( version_compare( $wgVersion, '1.11', '>=' ) )
-                       wfLoadExtensionMessages( 'Stalepages' );
+               wfLoadExtensionMessages( 'Stalepages' );
 
                $this->setHeaders();
                list( $limit, $offset ) = wfCheckLimits();



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to