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

Revision: 70280
Author:   platonides
Date:     2010-08-01 18:03:29 +0000 (Sun, 01 Aug 2010)

Log Message:
-----------
Do not use directly the $options global

Modified Paths:
--------------
    trunk/phase3/maintenance/parserTests.inc
    trunk/phase3/maintenance/parserTests.php

Modified: trunk/phase3/maintenance/parserTests.inc
===================================================================
--- trunk/phase3/maintenance/parserTests.inc    2010-08-01 16:56:39 UTC (rev 
70279)
+++ trunk/phase3/maintenance/parserTests.inc    2010-08-01 18:03:29 UTC (rev 
70280)
@@ -61,9 +61,7 @@
         * Sets terminal colorization and diff/quick modes depending on OS and
         * command-line options (--color and --quick).
         */
-       public function ParserTest() {
-               global $options;
-
+       public function ParserTest( $options = array() ) {
                # Only colorize output if stdout is a terminal.
                $this->color = !wfIsWindows() && posix_isatty( 1 );
 
@@ -103,7 +101,7 @@
                        $this->regex = '';
                }
 
-               $this->setupRecorder();
+               $this->setupRecorder( $options );
                $this->keepUploads = isset( $options['keep-uploads'] );
 
                if ( isset( $options['seed'] ) ) {
@@ -116,10 +114,11 @@
                $this->functionHooks = array();
        }
 
-       public function setupRecorder() {
-               global $options;
+       public function setupRecorder ( $options ) {
                if ( isset( $options['record'] ) ) {
                        $this->recorder = new DbTestRecorder( $this );
+                       $this->recorder->version = isset( 
$options['setversion'] ) ?    
+                                       $options['setversion'] : 
SpecialVersion::getVersion();
                } elseif ( isset( $options['compare'] ) ) {
                        $this->recorder = new DbTestPreviewer( $this );
                } elseif ( isset( $options['upload'] ) ) {
@@ -1438,12 +1437,14 @@
 }
 
 class DbTestRecorder extends DbTestPreviewer  {
+       var $version;
+
        /**
         * Set up result recording; insert a record for the run with the date
         * and all that fun stuff
         */
        function start() {
-               global $wgDBtype, $options;
+               global $wgDBtype;
                $this->db->begin();
 
                if ( ! $this->db->tableExists( 'testrun' )
@@ -1464,8 +1465,7 @@
                $this->db->insert( 'testrun',
                        array(
                                'tr_date'        => $this->db->timestamp(),
-                               'tr_mw_version'  => isset( 
$options['setversion'] ) ?
-                                       $options['setversion'] : 
SpecialVersion::getVersion(),
+                               'tr_mw_version'  => $this->version,
                                'tr_php_version' => phpversion(),
                                'tr_db_version'  => 
$this->db->getServerVersion(),
                                'tr_uname'       => php_uname()

Modified: trunk/phase3/maintenance/parserTests.php
===================================================================
--- trunk/phase3/maintenance/parserTests.php    2010-08-01 16:56:39 UTC (rev 
70279)
+++ trunk/phase3/maintenance/parserTests.php    2010-08-01 18:03:29 UTC (rev 
70280)
@@ -70,7 +70,7 @@
 # refer to $wgTitle directly, but instead use the title
 # passed to it.
 $wgTitle = Title::newFromText( 'Parser test script do not use' );
-$tester = new ParserTest();
+$tester = new ParserTest($options);
 
 if ( isset( $options['file'] ) ) {
        $files = array( $options['file'] );



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

Reply via email to