https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114224

Revision: 114224
Author:   tstarling
Date:     2012-03-20 00:28:30 +0000 (Tue, 20 Mar 2012)
Log Message:
-----------
Fixed attempt to write to the wiki's upload directory during parser tests 
instead of /tmp, this is not allowed. I'm not sure what setupGlobals() is meant 
to do nowadays, that part is untested. It seems to be duplicated in 
ParserTest::__construct().

Modified Paths:
--------------
    trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
    trunk/phase3/tests/parser/parserTest.inc

Modified: 
trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php
===================================================================
--- trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php     
2012-03-20 00:26:08 UTC (rev 114223)
+++ trunk/phase3/includes/filerepo/backend/lockmanager/LockManagerGroup.php     
2012-03-20 00:28:30 UTC (rev 114224)
@@ -31,6 +31,14 @@
        }
 
        /**
+        * Destroy the singleton instance, so that a new one will be created 
next
+        * time singleton() is called.
+        */
+       public static function destroySingleton() {
+               self::$instance = null;
+       }
+
+       /**
         * Register lock managers from the global variables
         * 
         * @return void

Modified: trunk/phase3/tests/parser/parserTest.inc
===================================================================
--- trunk/phase3/tests/parser/parserTest.inc    2012-03-20 00:26:08 UTC (rev 
114223)
+++ trunk/phase3/tests/parser/parserTest.inc    2012-03-20 00:28:30 UTC (rev 
114224)
@@ -140,7 +140,7 @@
                        $wgNamespaceAliases, $wgNamespaceProtection, 
$wgLocalFileRepo,
                        $parserMemc, $wgThumbnailScriptPath, $wgScriptPath,
                        $wgArticlePath, $wgStyleSheetPath, $wgScript, 
$wgStylePath, $wgExtensionAssetsPath,
-                       $wgMainCacheType, $wgMessageCacheType, 
$wgParserCacheType;
+                       $wgMainCacheType, $wgMessageCacheType, 
$wgParserCacheType, $wgLockManagers;
 
                $wgScript = '/index.php';
                $wgScriptPath = '/';
@@ -149,6 +149,11 @@
                $wgStylePath = '/skins';
                $wgExtensionAssetsPath = '/extensions';
                $wgThumbnailScriptPath = false;
+               $wgLockManagers = array( array(
+                       'name'          => 'fsLockManager',
+                       'class'         => 'FSLockManager',
+                       'lockDirectory' => wfTempDir() . '/test-repo/lockdir',
+               ) );
                $wgLocalFileRepo = array(
                        'class'           => 'LocalRepo',
                        'name'            => 'local',
@@ -627,6 +632,11 @@
                        'wgScriptPath' => '/',
                        'wgArticlePath' => '/wiki/$1',
                        'wgActionPaths' => array(),
+                       'wgLockManagers' => array(
+                               'name'          => 'fsLockManager',
+                               'class'         => 'FSLockManager',
+                               'lockDirectory' => $this->uploadDir . 
'/lockdir',
+                       ),
                        'wgLocalFileRepo' => array(
                                'class' => 'LocalRepo',
                                'name' => 'local',
@@ -951,6 +961,8 @@
         */
        private function teardownGlobals() {
                RepoGroup::destroySingleton();
+               FileBackendGroup::destroySingleton();
+               LockManagerGroup::destroySingleton();
                LinkCache::singleton()->clear();
 
                foreach ( $this->savedGlobals as $var => $val ) {


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

Reply via email to