Follow up to r71110, use of static var instead of global var, as suggested by Platonides
authorJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 24 Aug 2010 14:58:35 +0000 (14:58 +0000)
committerJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 24 Aug 2010 14:58:35 +0000 (14:58 +0000)
includes/GlobalFunctions.php

index 7152cf0..0b6e8f5 100644 (file)
@@ -3465,11 +3465,12 @@ function wfArrayMap( $function, $input ) {
  * @return PackageRepository
  */
 function wfGetRepository() {
-       global $wgRepository, $wgRepositoryApiLocation;
+       global $wgRepositoryApiLocation;
+       static $repository = false;
        
-       if ( !isset( $wgRepository ) ) {
-               $wgRepository = new DistributionRepository( $wgRepositoryApiLocation );
+       if ( $repository === false ) {
+               $repository = new DistributionRepository( $wgRepositoryApiLocation );
        }
        
-       return $wgRepository;
+       return $repository;
 }