r75111 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75110‎ | r75111 | r75112 >
Date:21:23, 20 October 2010
Author:reedy
Status:deferred
Tags:
Comment:
MFT 74568-75102
Modified paths:
  • /branches/querypage-work2/phase3/maintenance/Maintenance.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/archives (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/archives/patch-categorylinks-better-collation.sql (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/archives/patch-categorylinks-better-collation2.sql (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/cleanupTable.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/convertLinks.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/deleteSelfExternals.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/doMaintenance.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/dumpInterwiki.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/fixSlaveDesync.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/gearman/gearman.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/helloWorld.php (deleted) (history)
  • /branches/querypage-work2/phase3/maintenance/initEditCount.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/install-utils.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/lag.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/language/checkLanguage.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/language/countMessages.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/nextJobDB.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/oracle/tables.sql (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/oracle/user.sql (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/patchSql.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/populateRevisionLength.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/populateSha1.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/postgres/compare_schemas.pl (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/purgeOldText.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/renameDbPrefix.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/rollbackEdits.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/storage/checkStorage.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/storage/compressOld.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/storage/moveToExternal.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/storage/resolveStubs.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tables.sql (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/RunSeleniumTests.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/parser/parserTest.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/Makefile (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/bootstrap.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/CdbTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/ExtraParserTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/HttpTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/UploadFromUrlTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/UploadTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/db/DatabaseSqliteTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/parser/MediaWikiParserTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/search/SearchDbTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/search/SearchEngineTest.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/phpunit.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/phpunit/suite.xml (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/Selenium.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumConfig.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumServerManager.php (added) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumTestSuite.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumConfig.php (added) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumTestCase.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumTestSuite.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample (added) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/selenium/selenium_settings.ini.sample (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/tests/testHelpers.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/update.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/upgrade1_5.php (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/userDupes.inc (modified) (history)
  • /branches/querypage-work2/phase3/maintenance/userOptions.inc (modified) (history)

Diff [purge]

Index: branches/querypage-work2/phase3/maintenance/helloWorld.php
@@ -1,59 +0,0 @@
2 -<<<<<<< .working
3 -<?php
4 -
5 -/**
6 - * To the extent possible under law, I, Mark Hershberger, have waived all copyright and
7 - * related or neighboring rights to Hello World. This work is published from United States.
8 - * @copyright CC0 http://creativecommons.org/publicdomain/zero/1.0/
9 - * @author Mark A. Hershberger <mah@everybody.org>
10 - * @ingroup Maintenance
11 - */
12 -
13 -require_once( dirname( __FILE__ ) . "/Maintenance.php" );
14 -
15 -class CommandLineInstaller extends Maintenance {
16 -
17 - public function __construct() {
18 - parent::__construct();
19 -
20 - $this->addOption( 'name', 'Who to say Hello to', false, true);
21 - }
22 -
23 - public function execute() {
24 - $name = $this->getOption( 'name', 'World' );
25 - echo "Hello, $name!\n";
26 - }
27 -}
28 -
29 -wfRunMaintenance( "CommandLineInstaller" );
30 -
31 -=======
32 -<?php
33 -/**
34 - * To the extent possible under law, I, Mark Hershberger, have waived all copyright and
35 - * related or neighboring rights to Hello World. This work is published from United States.
36 - *
37 - * @file
38 - * @ingroup Maintenance
39 - * @copyright CC0 http://creativecommons.org/publicdomain/zero/1.0/
40 - * @author Mark A. Hershberger <mah@everybody.org>
41 - */
42 -
43 -require_once( dirname( __FILE__ ) . '/Maintenance.php' );
44 -
45 -class CommandLineInstaller extends Maintenance {
46 -
47 - public function __construct() {
48 - parent::__construct();
49 -
50 - $this->addOption( 'name', 'Who to say Hello to', false, true );
51 - }
52 -
53 - public function execute() {
54 - $name = $this->getOption( 'name', 'World' );
55 - echo "Hello, $name!\n";
56 - }
57 -}
58 -
59 -wfRunMaintenance( 'CommandLineInstaller' );
60 ->>>>>>> .merge-right.r72357
Index: branches/querypage-work2/phase3/maintenance/upgrade1_5.php
@@ -344,7 +344,7 @@
345345 __METHOD__ );
346346
347347 $add = array();
348 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 348+ foreach ( $result as $row ) {
349349 $copy = array();
350350 foreach ( $fields as $field => $source ) {
351351 if ( $source === MW_UPGRADE_COPY ) {
@@ -455,7 +455,7 @@
456456 FROM $cur
457457 ORDER BY cur_id", __METHOD__ );
458458 $add = array();
459 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 459+ foreach ( $result as $row ) {
460460 $add[] = array(
461461 'old_namespace' => $row->cur_namespace,
462462 'old_title' => $row->cur_title,
@@ -488,7 +488,7 @@
489489 __METHOD__ );
490490
491491 $add = array();
492 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 492+ foreach ( $result as $row ) {
493493 $add[] = array(
494494 'rev_id' => $row->old_id,
495495 'rev_page' => $row->cur_id,
@@ -516,7 +516,7 @@
517517 WHERE cur_id=rev_page AND rev_timestamp=cur_timestamp AND rev_id > {$maxold}
518518 ORDER BY cur_id", __METHOD__ );
519519 $add = array();
520 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 520+ foreach ( $result as $row ) {
521521 $add[] = array(
522522 'page_id' => $row->cur_id,
523523 'page_namespace' => $row->cur_namespace,
@@ -578,7 +578,7 @@
579579 FROM $links, $cur
580580 WHERE l_to=cur_id", __METHOD__ );
581581 $add = array();
582 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 582+ foreach ( $result as $row ) {
583583 $add[] = array(
584584 'pl_from' => $row->l_from,
585585 'pl_namespace' => $row->cur_namespace,
@@ -598,7 +598,7 @@
599599 "SELECT bl_from, bl_to FROM $brokenlinks",
600600 __METHOD__ );
601601 $add = array();
602 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 602+ foreach ( $result as $row ) {
603603 $pagename = $this->conv( $row->bl_to );
604604 $title = Title::newFromText( $pagename );
605605 if ( is_null( $title ) ) {
@@ -905,7 +905,7 @@
906906 __METHOD__ );
907907
908908 $add = array();
909 - while ( $row = $this->dbr->fetchObject( $result ) ) {
 909+ foreach ( $result as $row ) {
910910 $add[] = array(
911911 'wl_user' => $row->wl_user,
912912 'wl_namespace' => MWNamespace::getSubject( $row->wl_namespace ),
@@ -1214,7 +1214,7 @@
12151215 echo "Found $n titles with duplicate entries.\n";
12161216 if ( $n > 0 ) {
12171217 echo "Correcting...\n";
1218 - while ( $row = $dbw->fetchObject( $res ) ) {
 1218+ foreach ( $res as $row ) {
12191219 $ns = intval( $row->cur_namespace );
12201220 $title = $dbw->addQuotes( $row->cur_title );
12211221
Index: branches/querypage-work2/phase3/maintenance/postgres/compare_schemas.pl
@@ -273,7 +273,7 @@
274274 ## Simple text-only strings:
275275 ar_flags tinyblob TEXT
276276 cl_collation varbinary(32) TEXT
277 -cl_sortkey varbinary(255) TEXT
 277+cl_sortkey varbinary(230) TEXT
278278 ct_params blob TEXT
279279 fa_minor_mime varbinary(100) TEXT
280280 fa_storage_group varbinary(16) TEXT # Just 'deleted' for now, should stay plain text
Index: branches/querypage-work2/phase3/maintenance/Maintenance.php
@@ -9,11 +9,6 @@
1010 define( 'DO_MAINTENANCE', dirname( __FILE__ ) . '/doMaintenance.php' );
1111 $maintClass = false;
1212
13 -function wfRunMaintenance( $class ) {
14 - $maintClass = $class;
15 - require_once( DO_MAINTENANCE );
16 -}
17 -
1813 // Make sure we're on PHP5 or better
1914 if ( version_compare( PHP_VERSION, '5.1.0' ) < 0 ) {
2015 die ( "Sorry! This version of MediaWiki requires PHP 5.1.x; you are running " .
@@ -351,6 +346,7 @@
352347 $this->addOption( 'conf', 'Location of LocalSettings.php, if not default', false, true );
353348 $this->addOption( 'wiki', 'For specifying the wiki ID', false, true );
354349 $this->addOption( 'globals', 'Output globals at the end of processing for debugging' );
 350+ $this->addOption( 'memory-limit', 'Set a specific memory limit for the script, "max" for no limit or "default" to avoid changing it' );
355351 // If we support a DB, show the options
356352 if ( $this->getDbType() > 0 ) {
357353 $this->addOption( 'dbuser', 'The DB user to use for this script', false, true );
@@ -430,9 +426,12 @@
431427 // command-line mode is on, regardless of PHP version.
432428 }
433429
 430+ $this->loadParamsAndArgs();
 431+ $this->maybeHelp();
 432+
434433 # Set the memory limit
435434 # Note we need to set it again later in cache LocalSettings changed it
436 - ini_set( 'memory_limit', $this->memoryLimit() );
 435+ $this->adjustMemoryLimit();
437436
438437 # Set max execution time to 0 (no limit). PHP.net says that
439438 # "When running PHP from the command line the default setting is 0."
@@ -453,21 +452,37 @@
454453 # Turn off output buffering if it's on
455454 @ob_end_flush();
456455
457 - $this->loadParamsAndArgs();
458 - $this->maybeHelp();
459456 $this->validateParamsAndArgs();
460457 }
461458
462459 /**
463460 * Normally we disable the memory_limit when running admin scripts.
464461 * Some scripts may wish to actually set a limit, however, to avoid
465 - * blowing up unexpectedly.
 462+ * blowing up unexpectedly. We also support a --memory-limit option,
 463+ * to allow sysadmins to explicitly set one if they'd prefer to override
 464+ * defaults (or for people using Suhosin which yells at you for trying
 465+ * to disable the limits)
466466 */
467467 public function memoryLimit() {
468 - return -1;
 468+ $limit = $this->getOption( 'memory-limit', 'max' );
 469+ $limit = trim( $limit, "\" '" ); // trim quotes in case someone misunderstood
 470+ return $limit;
469471 }
470472
471473 /**
 474+ * Adjusts PHP's memory limit to better suit our needs, if needed.
 475+ */
 476+ protected function adjustMemoryLimit() {
 477+ $limit = $this->memoryLimit();
 478+ if ( $limit == 'max' ) {
 479+ $limit = -1; // no memory limit
 480+ }
 481+ if ( $limit != 'default' ) {
 482+ ini_set( 'memory_limit', $limit );
 483+ }
 484+ }
 485+
 486+ /**
472487 * Clear all params and arguments.
473488 */
474489 public function clearParamsAndArgs() {
@@ -702,7 +717,7 @@
703718
704719 $wgShowSQLErrors = true;
705720 @set_time_limit( 0 );
706 - ini_set( 'memory_limit', $this->memoryLimit() );
 721+ $this->adjustMemoryLimit();
707722
708723 $wgProfiling = false; // only for Profiler.php mode; avoids OOM errors
709724 }
Index: branches/querypage-work2/phase3/maintenance/purgeOldText.inc
@@ -21,7 +21,7 @@
2222 # Get "active" text records from the revisions table
2323 echo( "Searching for active text records in revisions table..." );
2424 $res = $dbw->query( "SELECT DISTINCT rev_text_id FROM $tbl_rev" );
25 - while ( $row = $dbw->fetchObject( $res ) ) {
 25+ foreach ( $res as $row ) {
2626 $cur[] = $row->rev_text_id;
2727 }
2828 echo( "done.\n" );
@@ -29,7 +29,7 @@
3030 # Get "active" text records from the archive table
3131 echo( "Searching for active text records in archive table..." );
3232 $res = $dbw->query( "SELECT DISTINCT ar_text_id FROM $tbl_arc" );
33 - while ( $row = $dbw->fetchObject( $res ) ) {
 33+ foreach ( $res as $row ) {
3434 $cur[] = $row->ar_text_id;
3535 }
3636 echo( "done.\n" );
@@ -39,7 +39,7 @@
4040 $set = implode( ', ', $cur );
4141 $res = $dbw->query( "SELECT old_id FROM $tbl_txt WHERE old_id NOT IN ( $set )" );
4242 $old = array();
43 - while ( $row = $dbw->fetchObject( $res ) ) {
 43+ foreach ( $res as $row ) {
4444 $old[] = $row->old_id;
4545 }
4646 echo( "done.\n" );
Index: branches/querypage-work2/phase3/maintenance/tables.sql
@@ -492,7 +492,7 @@
493493 -- A binary string obtained by applying a sortkey generation algorithm
494494 -- (Language::convertToSortkey()) to page_title, or cl_sortkey_prefix . "\0"
495495 -- . page_title if cl_sortkey_prefix is nonempty.
496 - cl_sortkey varbinary(255) NOT NULL default '',
 496+ cl_sortkey varbinary(230) NOT NULL default '',
497497
498498 -- A prefix for the raw sortkey manually specified by the user, either via
499499 -- [[Category:Foo|prefix]] or {{defaultsort:prefix}}. If nonempty, it's
Property changes on: branches/querypage-work2/phase3/maintenance/tables.sql
___________________________________________________________________
Modified: svn:mergeinfo
500500 Merged /trunk/phase3/maintenance/tables.sql:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Index: branches/querypage-work2/phase3/maintenance/fixSlaveDesync.php
@@ -28,9 +28,8 @@
2929 }
3030
3131 public function execute() {
32 - global $wgDBservers;
3332 $this->slaveIndexes = array();
34 - for ( $i = 1; $i < count( $wgDBservers ); $i++ ) {
 33+ for ( $i = 1; $i < wfGetLB()->getServerCount(); $i++ ) {
3534 if ( wfGetLB()->isNonZeroLoad( $i ) ) {
3635 $this->slaveIndexes[] = $i;
3736 }
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumTestSuite.php
@@ -1,7 +1,20 @@
22 <?php
3 -
 3+/*
 4+ * Sample test suite.
 5+ * Two ways to configure MW for these tests
 6+ * 1) If you are running multiple test suites, add the following in LocalSettings.php
 7+ * require_once("maintenance/tests/selenium/SimpleSeleniumConfig.php");
 8+ * $wgSeleniumTestConfigs['SimpleSeleniumTestSuite'] = 'SimpleSeleniumConfig::getSettings';
 9+ * OR
 10+ * 2) Add the following to your Localsettings.php
 11+ * $wgDefaultSkin = 'chick';
 12+ */
413 class SimpleSeleniumTestSuite extends SeleniumTestSuite
514 {
 15+ public function setUp() {
 16+ $this->setLoginBeforeTests( false );
 17+ parent::setUp();
 18+ }
619 public function addTests() {
720 $testFiles = array(
821 'maintenance/tests/selenium/SimpleSeleniumTestCase.php'
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample
@@ -0,0 +1,22 @@
 2+[browsers]
 3+
 4+firefox = "*firefox"
 5+iexploreproxy = "*iexploreproxy"
 6+chrome = "*chrome"
 7+
 8+[SeleniumSettings]
 9+
 10+host = "localhost"
 11+port = "4444"
 12+wikiUrl = "http://localhost/mediawiki/latest_trunk/trunk/phase3"
 13+username = "Wikiadmin"
 14+userPassword = "Wikiadminpw"
 15+testBrowser = "firefox"
 16+startserver =
 17+stopserver =
 18+jUnitLogFile =
 19+
 20+[testSuite]
 21+
 22+SimpleSeleniumTestSuite = "maintenance/tests/selenium/SimpleSeleniumTestSuite.php"
 23+PagedTiffHandlerSeleniumTestSuite = "extensions/PagedTiffHandler/selenium/PagedTiffHandlerTestSuite.php"
Property changes on: branches/querypage-work2/phase3/maintenance/tests/selenium/selenium_settings.ini.php52.sample
___________________________________________________________________
Added: svn:eol-style
124 + native
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumConfig.php
@@ -10,6 +10,7 @@
1111 * See sample config file in selenium_settings.ini.sample
1212 *
1313 */
 14+
1415 public static function getSeleniumSettings ( &$seleniumSettings,
1516 &$seleniumBrowsers,
1617 &$seleniumTestSuites,
@@ -23,7 +24,16 @@
2425 throw new MWException( "Unable to read local Selenium Settings from " . $seleniumConfigFile . "\n" );
2526 }
2627
27 - $configArray = parse_ini_file($seleniumConfigFile, true);
 28+ if ( !defined( 'PHP_VERSION_ID' ) ||
 29+ ( PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 3 ) ) {
 30+ $configArray = self::parse_5_2_ini_file( $seleniumConfigFile );
 31+ } else {
 32+ $configArray = parse_ini_file( $seleniumConfigFile, true );
 33+ }
 34+ if ( $configArray === false ) {
 35+ throw new MWException( "Error parsing " . $seleniumConfigFile . "\n" );
 36+ }
 37+
2838 if ( array_key_exists( 'SeleniumSettings', $configArray) ) {
2939 wfSuppressWarnings();
3040 //we may need to change how this is set. But for now leave it in the ini file
@@ -34,7 +44,12 @@
3545 $seleniumSettings['wikiUrl'] = $configArray['SeleniumSettings']['wikiUrl'];
3646 $seleniumSettings['username'] = $configArray['SeleniumSettings']['username'];
3747 $seleniumSettings['userPassword'] = $configArray['SeleniumSettings']['userPassword'];
38 - $seleniumSettings['testBrowser'] = $configArray['SeleniumSettings']['testBrowser'];
 48+ $seleniumSettings['testBrowser'] = $configArray['SeleniumSettings']['testBrowser'];
 49+ $seleniumSettings['startserver'] = $configArray['SeleniumSettings']['startserver'];
 50+ $seleniumSettings['stopserver'] = $configArray['SeleniumSettings']['stopserver'];
 51+ $seleniumSettings['seleniumserverexecpath'] = $configArray['SeleniumSettings']['seleniumserverexecpath'];
 52+ $seleniumSettings['jUnitLogFile'] = $configArray['SeleniumSettings']['jUnitLogFile'];
 53+
3954 wfRestoreWarnings();
4055 }
4156 if ( array_key_exists( 'SeleniumTests', $configArray) ) {
@@ -45,4 +60,28 @@
4661 return true;
4762 }
4863
 64+ private static function parse_5_2_ini_file ( $ConfigFile ) {
 65+
 66+ $configArray = parse_ini_file( $ConfigFile, true );
 67+ if ( $configArray === false ) return false;
 68+
 69+ // PHP 5.2 ini files have [browsers] and [testSuite] sections
 70+ // to get around lack of support for array keys. It then
 71+ // inserts the section arrays into the appropriate places in
 72+ // the SeleniumSettings and SeleniumTests arrays.
 73+
 74+ if ( isset( $configArray['browsers'] ) ) {
 75+ $configArray['SeleniumSettings']['browsers'] = $configArray['browsers'];
 76+ unset ( $configArray['browsers'] );
 77+ }
 78+
 79+ if ( isset( $configArray['testSuite'] ) ) {
 80+ $configArray['SeleniumTests']['testSuite'] = $configArray['testSuite'];
 81+ unset ( $configArray['testSuite'] );
 82+ }
 83+
 84+ return $configArray;
 85+
 86+ }
 87+
4988 }
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumTestCase.php
@@ -1,9 +1,10 @@
22 <?php
3 -
4 -class SimpleSeleniumTestCase extends SeleniumTestCase
5 -{
6 - public function testBasic()
7 - {
 3+/*
 4+ * This test case is part of the SimpleSeleniumTestSuite.
 5+ * Configuration for these tests are dosumented as part of SimpleSeleniumTestSuite.php
 6+ */
 7+class SimpleSeleniumTestCase extends SeleniumTestCase {
 8+ public function testBasic() {
89 $this->open( $this->getUrl() .
910 '/index.php?title=Selenium&action=edit' );
1011 $this->type( "wpTextbox1", "This is a basic test" );
@@ -14,19 +15,16 @@
1516 $source = $this->getText( "//div[@id='wikiPreview']/p" );
1617 $correct = strstr( $source, "This is a basic test" );
1718 $this->assertEquals( $correct, true );
18 -
1919 }
2020
2121 /*
22 - * Needs the following in your LocalConfig or an alternative method of configuration (coming soon)
23 - * require_once( "$IP/extensions/UsabilityInitiative/Vector/Vector.php" );
24 - * $wgDefaultSkin='vector';
 22+ * All this test really does is verify that a global var was set.
 23+ * It depends on $wgDefaultSkin = 'chick'; being set
2524 */
26 - public function testGlobalVariable1()
27 - {
 25+ public function testGlobalVariableForDefaultSkin() {
2826 $this->open( $this->getUrl() . '/index.php?&action=purge' );
2927 $bodyClass = $this->getAttribute( "//body/@class" );
30 - $this-> assertContains('skin-vector', $bodyClass, 'Vector skin not set');
 28+ $this-> assertContains('skin-chick', $bodyClass, 'Chick skin not set');
3129 }
3230
3331 }
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/selenium_settings.ini.sample
@@ -1,15 +1,29 @@
22 [SeleniumSettings]
33
 4+; Set up the available browsers that Selenium can control.
45 browsers[firefox] = "*firefox"
56 browsers[iexplorer] = "*iexploreproxy"
67 browsers[chrome] = "*chrome"
 8+
 9+; The simple configurations above usually work on Linux, but Windows and
 10+; Mac OS X hosts may need to specify a full path:
 11+;browsers[firefox] = "*firefox /Applications/Firefox.app/Contents/MacOS/firefox-bin"
 12+;browsers[firefox] = "*firefox C:\Program Files\Mozilla Firefox\firefox.exe"
 13+
714 host = "localhost"
815 port = "4444"
916 wikiUrl = "http://localhost/deployment"
1017 username = "wikiuser"
1118 userPassword = "wikipass"
1219 testBrowser = "firefox"
 20+startserver =
 21+stopserver =
 22+jUnitLogFile =
1323
 24+; To let the test runner start and stop the selenium server, it needs the full
 25+; path to selenium-server.jar from the selenium-remote-control package.
 26+seleniumserverexecpath = "/opt/local/selenium-remote-control-1.0.3/selenium-server-1.0.3/selenium-server.jar"
 27+
1428 [SeleniumTests]
1529
1630 testSuite[SimpleSeleniumTestSuite] = "maintenance/tests/selenium/SimpleSeleniumTestSuite.php"
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumTestSuite.php
@@ -3,6 +3,7 @@
44 abstract class SeleniumTestSuite extends PHPUnit_Framework_TestSuite {
55 private $selenium;
66 private $isSetUp = false;
 7+ private $loginBeforeTests = true;
78
89 // Do not add line break after test output
910 const CONTINUE_LINE = 1;
@@ -20,12 +21,14 @@
2122 $this->isSetUp = true;
2223 $this->selenium = Selenium::getInstance();
2324 $this->selenium->start();
24 - //$this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
25 - $this->login();
 25+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?setupTestSuite=' . $this->getName() );
 26+ if ( $this->loginBeforeTests ) {
 27+ $this->login();
 28+ }
2629 }
2730
2831 public function tearDown() {
29 - //$this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
 32+ $this->selenium->open( $this->selenium->getUrl() . '/index.php?clearTestSuite=' . $this->getName() );
3033 $this->selenium->stop();
3134 }
3235
@@ -36,4 +39,8 @@
3740 public function loadPage( $title, $action ) {
3841 $this->selenium->loadPage( $title, $action );
3942 }
 43+
 44+ protected function setLoginBeforeTests( $loginBeforeTests = true ) {
 45+ $this->loginBeforeTests = $loginBeforeTests;
 46+ }
4047 }
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/Selenium.php
@@ -21,6 +21,7 @@
2222 protected $pass;
2323 protected $timeout = 30000;
2424 protected $verbose;
 25+ protected $junitlogfile; //processed by phpUnderControl
2526
2627 /**
2728 * @todo this shouldn't have to be static
@@ -112,6 +113,10 @@
113114 $this->port = $port;
114115 }
115116
 117+ public function getPort() {
 118+ return $this->port;
 119+ }
 120+
116121 public function setUser( $user ) {
117122 $this->user = $user;
118123 }
@@ -132,6 +137,14 @@
133138 $this->browsers = $availableBrowsers;
134139 }
135140
 141+ public function setJUnitLogfile( $junitlogfile ) {
 142+ $this->junitlogfile = $junitlogfile;
 143+ }
 144+
 145+ public function getJUnitLogfile( ) {
 146+ return $this->junitlogfile;
 147+ }
 148+
136149 public function setBrowser( $b ) {
137150 if ( !isset( $this->browsers[$b] ) ) {
138151 throw new MWException( "Invalid Browser: $b.\n" );
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumConfig.php
@@ -0,0 +1,15 @@
 2+<?php
 3+class SimpleSeleniumConfig {
 4+
 5+ public static function getSettings(&$includeFiles, &$globalConfigs) {
 6+ $includes = array(
 7+ //files that needed to be included would go here
 8+ );
 9+ $configs = array(
 10+ 'wgDefaultSkin' => 'chick'
 11+ );
 12+ $includeFiles = array_merge( $includeFiles, $includes );
 13+ $globalConfigs = array_merge( $globalConfigs, $configs);
 14+ return true;
 15+ }
 16+}
\ No newline at end of file
Property changes on: branches/querypage-work2/phase3/maintenance/tests/selenium/SimpleSeleniumConfig.php
___________________________________________________________________
Added: svn:eol-style
117 + native
Index: branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumServerManager.php
@@ -0,0 +1,239 @@
 2+<?php
 3+/**
 4+ * Selenium server manager
 5+ *
 6+ * @file
 7+ * @ingroup Maintenance
 8+ * Copyright (C) 2010 Dan Nessett <dnessett@yahoo.com>
 9+ * http://citizendium.org/
 10+ *
 11+ * This program is free software; you can redistribute it and/or modify
 12+ * it under the terms of the GNU General Public License as published by
 13+ * the Free Software Foundation; either version 2 of the License, or
 14+ * (at your option) any later version.
 15+ *
 16+ * This program is distributed in the hope that it will be useful,
 17+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 19+ * GNU General Public License for more details.
 20+ *
 21+ * You should have received a copy of the GNU General Public License along
 22+ * with this program; if not, write to the Free Software Foundation, Inc.,
 23+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 24+ * http://www.gnu.org/copyleft/gpl.html
 25+ *
 26+ * @addtogroup Maintenance
 27+ */
 28+
 29+class SeleniumServerManager {
 30+ private $SeleniumStartServer = false;
 31+ private $OS = '';
 32+ private $SeleniumServerPid = 'NaN';
 33+ private $SeleniumServerPort = 4444;
 34+ private $SeleniumServerStartTimeout = 10; // 10 secs.
 35+ private $SeleniumServerExecPath;
 36+
 37+ public function __construct( $startServer,
 38+ $serverPort,
 39+ $serverExecPath ) {
 40+ $this->OS = (string) PHP_OS;
 41+ if ( isset( $startServer ) )
 42+ $this->SeleniumStartServer = $startServer;
 43+ if ( isset( $serverPort ) )
 44+ $this->SeleniumServerPort = $serverPort;
 45+ if ( isset( $serverExecPath ) )
 46+ $this->SeleniumServerExecPath = $serverExecPath;
 47+ return;
 48+ }
 49+
 50+ // Getters for certain private attributes. No setters, since they
 51+ // should not change after the manager object is created.
 52+
 53+ public function getSeleniumStartServer() {
 54+ return $this->SeleniumStartServer;
 55+ }
 56+
 57+ public function getSeleniumServerPort() {
 58+ return $this->SeleniumServerPort;
 59+ }
 60+
 61+ public function getSeleniumServerPid() {
 62+ return $this->SeleniumServerPid;
 63+ }
 64+
 65+ // Changing value of SeleniumStartServer allows starting server after
 66+ // creation of the class instance. Only allow setting SeleniumStartServer
 67+ // to true, since after server is started, it is shut down by stop().
 68+
 69+ public function setSeleniumStartServer( $startServer ) {
 70+ if ( $startServer == true ) $this->SeleniumStartServer = true;
 71+ }
 72+
 73+ // return values are: 1) started - server started, 2) failed -
 74+ // server not started, 3) running - instructed to start server, but
 75+ // server already running
 76+
 77+ public function start() {
 78+
 79+ if ( !$this->SeleniumStartServer ) return 'failed';
 80+
 81+ // commented out cases are untested
 82+
 83+ switch ( $this->OS ) {
 84+ case "Linux":
 85+# case' CYGWIN_NT-5.1':
 86+ case 'Darwin':
 87+# case 'FreeBSD':
 88+# case 'HP-UX':
 89+# case 'IRIX64':
 90+# case 'NetBSD':
 91+# case 'OpenBSD':
 92+# case 'SunOS':
 93+# case 'Unix':
 94+ // *nix based OS
 95+ return $this->startServerOnUnix();
 96+ break;
 97+ case "Windows":
 98+ case "WIN32":
 99+ case "WINNT":
 100+ // Windows
 101+ return $this->startServerOnWindows();
 102+ break;
 103+ default:
 104+ // An untested OS
 105+ return 'failed';
 106+ break;
 107+ }
 108+ }
 109+
 110+ public function stop() {
 111+
 112+ // commented out cases are untested
 113+
 114+ switch ( $this->OS ) {
 115+ case "Linux":
 116+# case' CYGWIN_NT-5.1':
 117+ case 'Darwin':
 118+# case 'FreeBSD':
 119+# case 'HP-UX':
 120+# case 'IRIX64':
 121+# case 'NetBSD':
 122+# case 'OpenBSD':
 123+# case 'SunOS':
 124+# case 'Unix':
 125+ // *nix based OS
 126+ return $this->stopServerOnUnix();
 127+ break;
 128+ case "Windows":
 129+ case "WIN32":
 130+ case "WINNT":
 131+ // Windows
 132+ return $this->stopServerOnWindows();
 133+ break;
 134+ default:
 135+ // An untested OS
 136+ return 'failed';
 137+ break;
 138+ }
 139+ }
 140+
 141+ private function startServerOnUnix() {
 142+
 143+ $output = array();
 144+ $user = $_ENV['USER'];
 145+ // @fixme this should be a little more generalized :)
 146+ if (PHP_OS == 'Darwin') {
 147+ // Mac OS X's ps barfs on the 'w' param, but doesn't need it.
 148+ $ps = "ps -U %s";
 149+ } else {
 150+ // Good on Linux
 151+ $ps = "ps -U %s w";
 152+ }
 153+ $psCommand = sprintf($ps, escapeshellarg($user));
 154+ exec($psCommand . " | grep -i selenium-server", $output);
 155+
 156+ // Start server. If there is already a server running,
 157+ // return running.
 158+
 159+ if ( isset( $this->SeleniumServerExecPath ) ) {
 160+ $found = 0;
 161+ foreach ( $output as $string ) {
 162+ $found += preg_match(
 163+ '~^(.*)java(.+)-jar(.+)selenium-server~',
 164+ $string );
 165+ }
 166+ if ( $found == 0 ) {
 167+
 168+ // Didn't find the selenium server. Start it up.
 169+ // First set up comamand line suffix.
 170+ // NB: $! is pid of last job run in background
 171+ // The echo guarentees it is put into $op when
 172+ // the exec command is run.
 173+
 174+ $commandSuffix = ' > /dev/null 2>&1'. ' & echo $!';
 175+ $portText = ' -port ' . $this->SeleniumServerPort;
 176+ $command = "java -jar " .
 177+ escapeshellarg($this->SeleniumServerExecPath) .
 178+ $portText . $commandSuffix;
 179+ exec($command ,$op);
 180+ $pid = (int)$op[0];
 181+ if ( $pid != "" )
 182+ $this->SeleniumServerPid = $pid;
 183+ else {
 184+ $this->SeleniumServerPid = 'NaN';
 185+ // Server start failed.
 186+ return 'failed';
 187+ }
 188+ // Wait for the server to startup and listen
 189+ // on its port. Note: this solution kinda
 190+ // stinks, since it uses a wait loop - dnessett
 191+
 192+ wfSuppressWarnings();
 193+ for ( $cnt = 1;
 194+ $cnt <= $this->SeleniumServerStartTimeout;
 195+ $cnt++ ) {
 196+ $fp = fsockopen ( 'localhost',
 197+ $this->SeleniumServerPort,
 198+ $errno, $errstr, 0 );
 199+ if ( !$fp ) {
 200+ sleep( 1 );
 201+ continue;
 202+ // Server start succeeded.
 203+ } else {
 204+ fclose ( $fp );
 205+ return 'started';
 206+ }
 207+ }
 208+ wfRestoreWarnings();
 209+ echo ( "Starting Selenium server timed out.\n" );
 210+ return 'failed';
 211+ }
 212+ // server already running.
 213+ else return 'running';
 214+
 215+ }
 216+ // No Server execution path defined.
 217+ return 'failed';
 218+ }
 219+
 220+ private function startServerOnWindows() {
 221+ // Unimplemented.
 222+ return 'failed';
 223+ }
 224+
 225+ private function stopServerOnUnix() {
 226+
 227+ if ( !empty( $this->SeleniumServerPid ) &&
 228+ $this->SeleniumServerPid != 'NaN' ) {
 229+ exec( "kill -9 " . $this->SeleniumServerPid );
 230+ return 'stopped';
 231+ }
 232+ else return 'failed';
 233+ }
 234+
 235+ private function stopServerOnWindows() {
 236+ // Unimplemented.
 237+ return 'failed';
 238+
 239+ }
 240+}
Property changes on: branches/querypage-work2/phase3/maintenance/tests/selenium/SeleniumServerManager.php
___________________________________________________________________
Added: svn:eol-style
1241 + native
Added: svn:keywords
2242 + LastChangedDate LastChangedBy Revision Id
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/bootstrap.php
@@ -31,33 +31,22 @@
3232 /* Classes */
3333
3434 abstract class MediaWikiTestSetup extends PHPUnit_Framework_TestCase {
 35+ protected $suite;
 36+ public $regex = '';
 37+ public $runDisabled = false;
3538
36 - protected function buildTestDatabase( $tables ) {
37 - global $wgDBprefix;
38 -
39 - $db = wfGetDB( DB_MASTER );
40 - $oldTableNames = array();
41 - foreach ( $tables as $table )
42 - $oldTableNames[$table] = $db->tableName( $table );
43 - if ( $db->getType() == 'oracle' ) {
44 - $wgDBprefix = 'pt_';
45 - } else {
46 - $wgDBprefix = 'parsertest_';
 39+ function __construct( PHPUnit_Framework_TestSuite $suite = null ) {
 40+ if ( null !== $suite ) {
 41+ $this->suite = $suite;
4742 }
 43+ }
4844
49 - $db->tablePrefix( $wgDBprefix );
50 -
51 - if ( $db->isOpen() ) {
52 - foreach ( $tables as $tbl ) {
53 - $newTableName = $db->tableName( $tbl );
54 - $tableName = $oldTableNames[$tbl];
55 - $db->query( "DROP TABLE IF EXISTS $newTableName", __METHOD__ );
56 - $db->duplicateTableStructure( $tableName, $newTableName, __METHOD__ );
57 - }
58 - return $db;
 45+ function __call( $func, $args ) {
 46+ if ( method_exists( $this->suite, $func ) ) {
 47+ return call_user_func_array( array( $this->suite, $func ), $args);
5948 } else {
60 - // Something amiss
61 - return null;
 49+ throw new MWException( "Called non-existant $func method on "
 50+ . get_class( $this ) );
6251 }
6352 }
6453 }
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/db/DatabaseSqliteTest.php
@@ -23,7 +23,7 @@
2424 class DatabaseSqliteTest extends PHPUnit_Framework_TestCase {
2525 var $db;
2626
27 - public function setup() {
 27+ public function setUp() {
2828 if ( !Sqlite::isPresent() ) {
2929 $this->markTestSkipped( 'No SQLite support detected' );
3030 }
@@ -84,4 +84,4 @@
8585 $this->fail( $result );
8686 }
8787 }
88 -}
 88+}
\ No newline at end of file
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/ExtraParserTest.php
@@ -23,11 +23,14 @@
2424
2525 // Bug 8689 - Long numeric lines kill the parser
2626 function testBug8689() {
 27+ global $wgLang;
 28+ global $wgUser;
2729 $longLine = '1.' . str_repeat( '1234567890', 100000 ) . "\n";
2830
 31+ if ( $wgLang === null ) $wgLang = new Language;
2932 $parser = new Parser();
3033 $t = Title::newFromText( 'Unit test' );
31 - $options = new ParserOptions();
 34+ $options = ParserOptions::newFromUser( $wgUser );
3235 $this->assertEquals( "<p>$longLine</p>",
3336 $parser->parse( $longLine, $t, $options )->getText() );
3437 }
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/parser/ParserHelpers.php
@@ -1,5 +1,21 @@
22 <?php
33
 4+class PHPUnitParserTest extends ParserTest {
 5+ function showTesting( $desc ) {
 6+ /* Do nothing since we don't want to show info during PHPUnit testing. */
 7+ }
 8+
 9+ public function showSuccess( $desc ) {
 10+ PHPUnit_Framework_Assert::assertTrue( true, $desc );
 11+ return true;
 12+ }
 13+
 14+ public function showFailure( $desc, $expected, $got ) {
 15+ PHPUnit_Framework_Assert::assertEquals( $expected, $got, $desc );
 16+ return false;
 17+ }
 18+}
 19+
420 class ParserUnitTest extends PHPUnit_Framework_TestCase {
521 private $test = "";
622 private $suite;
@@ -17,9 +33,9 @@
1834 $result = new PHPUnit_Framework_TestResult;
1935 }
2036
21 - $backend = $this->suite->getBackend();
 37+ $backend = new ParserTestSuiteBackend;
2238 $result->startTest( $this );
23 -
 39+
2440 // Support the transition to PHPUnit 3.5 where PHPUnit_Util_Timer is replaced with PHP_Timer
2541 if ( class_exists( 'PHP_Timer' ) ) {
2642 PHP_Timer::start();
@@ -32,16 +48,13 @@
3349 # Run the test.
3450 # On failure, the subclassed backend will throw an exception with
3551 # the details.
36 - $r = $backend->runTest(
37 - $this->test['test'],
38 - $this->test['input'],
39 - $this->test['result'],
40 - $this->test['options'],
41 - $this->test['config']
 52+ $pt = new PHPUnitParserTest;
 53+ $r = $pt->runTest( $this->test['test'], $this->test['input'],
 54+ $this->test['result'], $this->test['options'], $this->test['config']
4255 );
4356 }
4457 catch ( PHPUnit_Framework_AssertionFailedError $e ) {
45 -
 58+
4659 // PHPUnit_Util_Timer -> PHP_Timer support (see above)
4760 if ( class_exists( 'PHP_Timer' ) ) {
4861 $result->addFailure( $this, $e, PHP_Timer::stop() );
@@ -77,20 +90,29 @@
7891
7992 }
8093
81 -class ParserTestSuiteBackend extends ParserTest {
 94+class ParserTestSuiteBackend extends PHPUnit_FrameWork_TestSuite {
 95+ public $recorder;
 96+ public $term;
 97+ static $usePHPUnit = false;
 98+
 99+ function __construct() {
 100+ parent::__construct();
 101+ $this->setupRecorder(null);
 102+ self::$usePHPUnit = method_exists('PHPUnit_Framework_Assert', 'assertEquals');
 103+ }
 104+
82105 function showTesting( $desc ) {
83106 }
84107
85108 function showRunFile( $path ) {
86109 }
87110
88 - function showSuccess( $desc ) {
89 - PHPUnit_Framework_Assert::assertTrue( true, $desc );
90 - return true;
 111+ function showTestResult( $desc, $result, $out ) {
 112+ if ( $result === $out ) {
 113+ return self::showSuccess( $desc, $result, $out );
 114+ } else {
 115+ return self::showFailure( $desc, $result, $out );
91116 }
92 -
93 - function showFailure( $desc, $expected, $got ) {
94 - PHPUnit_Framework_Assert::assertEquals( $expected, $got, $desc );
95117 }
96118
97119 public function setupRecorder( $options ) {
@@ -107,4 +129,3 @@
108130
109131 function reportPercentage( $success, $total ) { }
110132 }
111 -
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/parser/MediaWikiParserTest.php
@@ -1,41 +1,34 @@
22 <?php
33
44 require_once( dirname( __FILE__ ) . '/ParserHelpers.php' );
 5+require_once( dirname(dirname(dirname( __FILE__ ))) . '/bootstrap.php' );
56
6 -class MediaWikiParserTest extends PHPUnit_Framework_TestSuite {
7 - private $count;
 7+class MediaWikiParserTest extends MediaWikiTestSetup {
 8+ public $count;
89 public $backend;
910
10 - public static function suite() {
11 - return new self;
12 - }
13 -
1411 public function __construct() {
 12+ $suite = new PHPUnit_Framework_TestSuite('Parser Tests');
 13+ parent::__construct($suite);
1514 $this->backend = new ParserTestSuiteBackend;
16 - parent::__construct();
1715 $this->setName( 'Parser tests' );
1816 }
1917
20 - public function run( PHPUnit_Framework_TestResult $result = null, $filter = false,
21 - array $groups = array(), array $excludeGroups = array(), $processIsolation = false
22 - ) {
23 - global $IP, $wgContLang, $wgMemc;
24 - $wgContLang = Language::factory( 'en' );
25 - $wgMemc = new FakeMemCachedClient;
26 - $this->backend->setupDatabase();
 18+ public static function suite() {
 19+ global $IP;
2720
 21+ $tester = new self;
 22+
2823 $iter = new TestFileIterator( "$IP/maintenance/tests/parser/parserTests.txt" );
29 - $iter->setParser( $this->backend );
30 - $this->count = 0;
 24+ $iter->setParser( $tester );
 25+ $tester->count = 0;
3126
3227 foreach ( $iter as $test ) {
33 - $this->addTest( new ParserUnitTest( $this, $test ) );
34 - $this->count++;
 28+ $tester->suite->addTest( new ParserUnitTest( $tester, $test ), array( 'Parser' ) );
 29+ $tester->count++;
3530 }
3631
37 - parent::run( $result, $filter, $groups, $excludeGroups, $processIsolation );
38 -
39 - $this->backend->teardownDatabase();
 32+ return $tester->suite;
4033 }
4134
4235 public function count() {
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/HttpTest.php
@@ -27,7 +27,7 @@
2828
2929 var $test_posturl = array( "http://www.comp.leeds.ac.uk/cgi-bin/Perl/environment-example" => "review=test" );
3030
31 - function setup() {
 31+ function setUp() {
3232 putenv( "http_proxy" ); /* Remove any proxy env var, so curl doesn't get confused */
3333 if ( is_array( self::$content ) ) {
3434 return;
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/search/SearchDbTest.php
@@ -6,11 +6,15 @@
77 var $db;
88
99 function setUp() {
 10+ // Get a database connection or skip test
1011 $this->db = wfGetDB( DB_MASTER );
1112 if ( !$this->db ) {
1213 $this->markTestIncomplete( "Can't find a database to test with." );
1314 }
1415
 16+ parent::setup();
 17+
 18+ // Initialize search database with data
1519 $GLOBALS['wgContLang'] = new Language;
1620 $this->insertSearchData();
1721
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/search/SearchEngineTest.php
@@ -1,13 +1,31 @@
22 <?php
33
4 -require_once dirname(__FILE__) . '/../../bootstrap.php';
 4+require_once dirname(dirname(dirname(__FILE__))). '/bootstrap.php';
55
66 /**
 7+ * This class is not directly tested. Instead it is extended by SearchDbTest.
78 * @group Stub
89 */
910 class SearchEngineTest extends MediaWikiTestSetup {
1011 var $db, $search, $pageList;
1112
 13+ /*
 14+ * Checks for database type & version.
 15+ * Will skip current test if DB does not support search.
 16+ */
 17+ function setUp() {
 18+ // Search tests require MySQL or SQLite with FTS
 19+ # Get database type and version
 20+ $dbType = $this->db->getType();
 21+ $dbSupported =
 22+ ($dbType === 'mysql')
 23+ || ( $dbType === 'sqlite' && $this->db->getFulltextSearchModule() == 'FTS3' );
 24+
 25+ if( !$dbSupported ) {
 26+ $this->markTestSkipped( "MySQL or SQLite with FTS3 only" );
 27+ }
 28+ }
 29+
1230 function pageExists( $title ) {
1331 return false;
1432 }
@@ -47,9 +65,6 @@
4866 function fetchIds( $results ) {
4967 $this->assertTrue( is_object( $results ) );
5068
51 - if ( $this->db->getType() !== 'mysql' && $this->db->getType() !== 'sqlite' ) {
52 - $this->markTestSkipped( "MySQL or SQLite only" );
53 - }
5469 $matches = array();
5570 while ( $row = $results->next() ) {
5671 $matches[] = $row->getTitle()->getPrefixedText();
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php
@@ -19,10 +19,6 @@
2020
2121 class ApiTest extends ApiTestSetup {
2222
23 - function setup() {
24 - parent::setup();
25 - }
26 -
2723 function testRequireOnlyOneParameterDefault() {
2824 $mock = new MockApi();
2925
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/UploadTest.php
@@ -8,7 +8,7 @@
99
1010 function setUp() {
1111 global $wgContLang;
12 - parent::setup();
 12+ parent::setUp();
1313 $wgContLang = Language::factory( 'en' );
1414 $this->upload = new UploadTestHandler;
1515 }
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/CdbTest.php
@@ -6,7 +6,7 @@
77
88 class CdbTest extends PHPUnit_Framework_TestCase {
99
10 - public function setup() {
 10+ public function setUp() {
1111 if ( !CdbReader::haveExtension() ) {
1212 $this->markTestIncomplete( 'This test requires native CDB support to be present.' );
1313 }
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/includes/UploadFromUrlTest.php
@@ -9,7 +9,7 @@
1010
1111 public function setUp() {
1212 global $wgEnableUploads, $wgAllowCopyUploads, $wgAllowAsyncCopyUploads;
13 - parent::setup();
 13+ parent::setUp();
1414
1515 $wgEnableUploads = true;
1616 $wgAllowCopyUploads = true;
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/suite.xml
@@ -6,7 +6,8 @@
77 convertErrorsToExceptions="true"
88 convertNoticesToExceptions="true"
99 convertWarningsToExceptions="true"
10 - stopOnFailure="false">
 10+ stopOnFailure="false"
 11+ strict="true">
1112 <testsuites>
1213 <testsuite name="includes">
1314 <directory>./includes</directory>
@@ -26,6 +27,7 @@
2728 </testsuites>
2829 <groups>
2930 <exclude>
 31+ <group>Utility</group>
3032 <group>Broken</group>
3133 <group>Stub</group>
3234 </exclude>
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/Makefile
@@ -1,4 +1,5 @@
2 -.PHONY: help test phpunit install coverage warning destructive
 2+.PHONY: help test phpunit install coverage warning destructive parser noparser list-groups
 3+.DEFAULT: warning
34
45 SHELL = /bin/sh
56 CONFIG_FILE = $(shell pwd)/suite.xml
@@ -8,6 +9,7 @@
910 all test: warning
1011
1112 warning:
 13+ # Use 'make help' to get usage
1214 @echo "WARNING -- these tests are DESTRUCTIVE and will alter your wiki."
1315 @echo "DO NOT RUN THESE TESTS on a production wiki."
1416 @echo ""
@@ -32,6 +34,15 @@
3335 coverage:
3436 ${PU} --coverage-html ../../../docs/code-coverage
3537
 38+parser:
 39+ ${PU} --group Parser
 40+
 41+noparser:
 42+ ${PU} --exclude-group Parser
 43+
 44+list-groups:
 45+ ${PU} --list-groups
 46+
3647 help:
3748 # Usage:
3849 # make <target> [OPTION=value]
@@ -43,6 +54,10 @@
4455 # help You're looking at it!
4556 # coverage Run the tests and generates an HTML code coverage report
4657 # You will need the Xdebug PHP extension for the later.
 58+ # [no]parser Skip or only run Parser tests
 59+ #
 60+ # list-groups List availabe Tests groups.
 61+ #
4762 # Options:
4863 # CONFIG_FILE Path to a PHPUnit configuration file (default: suite.xml)
4964 # FLAGS Additional flags to pass to PHPUnit
Index: branches/querypage-work2/phase3/maintenance/tests/phpunit/phpunit.php
@@ -23,12 +23,12 @@
2424 // To prevent tests from failing with SQLite, we need to turn database caching off
2525 $wgCaches[CACHE_DB] = false;
2626
27 -$targetFile = wfIsWindows() ? 'phpunit.php' : 'phpunit';
28 -$pathSeparator = wfIsWindows() ? ';' : ':';
29 -
30 -$folders = explode( $pathSeparator, getenv('PATH') );
31 -
32 -require 'PHPUnit/TextUI/Command.php';
33 -define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
 27+require_once( 'PHPUnit/Runner/Version.php' );
 28+if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) {
 29+ # PHPUnit 3.5.0 introduced a nice autoloader based on class name
 30+ require_once( 'PHPUnit/Autoload.php' );
 31+} else {
 32+ # Keep the old pre PHPUnit 3.5.0 behaviour for compatibility
 33+ require_once( 'PHPUnit/TextUI/Command.php' );
 34+}
3435 PHPUnit_TextUI_Command::main();
35 -
Index: branches/querypage-work2/phase3/maintenance/tests/testHelpers.inc
@@ -478,7 +478,7 @@
479479 $this->lineNum = $this->index = 0;
480480 }
481481
482 - function setParser( ParserTest $parser ) {
 482+ function setParser( MediaWikiParserTest $parser ) {
483483 $this->parser = $parser;
484484 }
485485
@@ -536,11 +536,10 @@
537537 wfDie( "'endarticle' without 'article' at line {$this->lineNum} of $this->file\n" );
538538 }
539539
540 - if ( $this->parser ) {
541 - $this->parser->addArticle( $this->parser->chomp( $data['article'] ), $this->parser->chomp( $data['text'] ),
542 - $this->lineNum );
543 - }
544 -
 540+ $title = Title::newFromText( ParserTest::chomp( $data['article'] ) );
 541+ $aid = $title->getArticleID( Title::GAID_FOR_UPDATE );
 542+ if ( $aid == 0 )
 543+ ParserTest::addArticle( $data['article'], $data['text'], $this->lineNum );
545544 $data = array();
546545 $section = null;
547546
@@ -632,11 +631,11 @@
633632
634633 if ( $this->parser ) {
635634 $this->test = array(
636 - 'test' => $this->parser->chomp( $data['test'] ),
637 - 'input' => $this->parser->chomp( $data['input'] ),
638 - 'result' => $this->parser->chomp( $data['result'] ),
639 - 'options' => $this->parser->chomp( $data['options'] ),
640 - 'config' => $this->parser->chomp( $data['config'] ) );
 635+ 'test' => ParserTest::chomp( $data['test'] ),
 636+ 'input' => ParserTest::chomp( $data['input'] ),
 637+ 'result' => ParserTest::chomp( $data['result'] ),
 638+ 'options' => ParserTest::chomp( $data['options'] ),
 639+ 'config' => ParserTest::chomp( $data['config'] ) );
641640 } else {
642641 $this->test['test'] = $data['test'];
643642 }
Index: branches/querypage-work2/phase3/maintenance/tests/parser/parserTest.inc
@@ -56,7 +56,10 @@
5757 private $maxFuzzTestLength = 300;
5858 private $fuzzSeed = 0;
5959 private $memoryLimit = 50;
 60+ private $uploadDir = null;
6061
 62+ public $regex = "";
 63+ private $savedGlobals = array();
6164 /**
6265 * Sets terminal colorization and diff/quick modes depending on OS and
6366 * command-line options (--color and --quick).
@@ -113,8 +116,59 @@
114117
115118 $this->hooks = array();
116119 $this->functionHooks = array();
 120+ self::setUp();
117121 }
118122
 123+ static function setUp() {
 124+ global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgDeferredUpdateList,
 125+ $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache,
 126+ $wgMessageCache, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $parserMemc,
 127+ $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo,
 128+ $wgThumbnailScriptPath, $wgScriptPath,
 129+ $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
 130+
 131+ $wgScript = '/index.php';
 132+ $wgScriptPath = '/';
 133+ $wgArticlePath = '/wiki/$1';
 134+ $wgStyleSheetPath = '/skins';
 135+ $wgStylePath = '/skins';
 136+ $wgThumbnailScriptPath = false;
 137+ $wgLocalFileRepo = array(
 138+ 'class' => 'LocalRepo',
 139+ 'name' => 'local',
 140+ 'directory' => wfTempDir() . '/test-repo',
 141+ 'url' => 'http://example.com/images',
 142+ 'deletedDir' => wfTempDir() . '/test-repo/delete',
 143+ 'hashLevels' => 2,
 144+ 'transformVia404' => false,
 145+ );
 146+ $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
 147+ $wgNamespaceAliases['Image'] = NS_FILE;
 148+ $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
 149+
 150+
 151+ $wgEnableParserCache = false;
 152+ $wgDeferredUpdateList = array();
 153+ $wgMemc =& wfGetMainCache();
 154+ $messageMemc =& wfGetMessageCacheStorage();
 155+ $parserMemc =& wfGetParserCacheStorage();
 156+
 157+ // $wgContLang = new StubContLang;
 158+ $wgUser = new User;
 159+ $wgLang = new StubUserLang;
 160+ $wgOut = new StubObject( 'wgOut', 'OutputPage' );
 161+ $wgParser = new StubObject( 'wgParser', $wgParserConf['class'], array( $wgParserConf ) );
 162+ $wgRequest = new WebRequest;
 163+
 164+ $wgMessageCache = new StubObject( 'wgMessageCache', 'MessageCache',
 165+ array( $messageMemc, $wgUseDatabaseMessages,
 166+ $wgMsgCacheExpiry ) );
 167+ if ( $wgStyleDirectory === false ) {
 168+ $wgStyleDirectory = "$IP/skins";
 169+ }
 170+
 171+ }
 172+
119173 public function setupRecorder ( $options ) {
120174 if ( isset( $options['record'] ) ) {
121175 $this->recorder = new DbTestRecorder( $this );
@@ -131,8 +185,9 @@
132186
133187 /**
134188 * Remove last character if it is a newline
 189+ * @group utility
135190 */
136 - public function chomp( $s ) {
 191+ static public function chomp( $s ) {
137192 if ( substr( $s, -1 ) === "\n" ) {
138193 return substr( $s, 0, -1 );
139194 }
@@ -302,7 +357,7 @@
303358 function runTests( $tests ) {
304359 $ok = true;
305360
306 - foreach ( $tests as $i => $t ) {
 361+ foreach ( $tests as $t ) {
307362 $result =
308363 $this->runTest( $t['test'], $t['input'], $t['result'], $t['options'], $t['config'] );
309364 $ok = $ok && $result;
@@ -421,13 +476,20 @@
422477 $result = $this->tidy( $result );
423478 }
424479
425 -
426480 $this->teardownGlobals();
 481+ return $this->showTestResult( $desc, $result, $out );
 482+ }
427483
428 - if ( $result === $out && ( $noxml === true || $this->wellFormed( $out ) ) ) {
429 - return $this->showSuccess( $desc );
 484+ /**
 485+ *
 486+ */
 487+ function showTestResult( $desc, $result, $out ) {
 488+ if ( $result === $out ) {
 489+ $this->showSuccess( $desc );
 490+ return true;
430491 } else {
431 - return $this->showFailure( $desc, $result, $out );
 492+ $this->showFailure( $desc, $result, $out );
 493+ return false;
432494 }
433495 }
434496
@@ -820,6 +882,7 @@
821883 global $wgDBtype;
822884
823885 if ( !$this->databaseSetupDone ) {
 886+ $this->teardownGlobals();
824887 return;
825888 }
826889 $this->teardownUploadDir( $this->uploadDir );
@@ -829,6 +892,7 @@
830893
831894 if ( $this->useTemporaryTables ) {
832895 # Don't need to do anything
 896+ $this->teardownGlobals();
833897 return;
834898 }
835899
@@ -842,6 +906,8 @@
843907
844908 if ( $wgDBtype == 'oracle' )
845909 $db->query( 'BEGIN FILL_WIKI_INFO; END;' );
 910+
 911+ $this->teardownGlobals();
846912 }
847913
848914 /**
@@ -1085,20 +1151,26 @@
10861152 * @param $text String: the article text
10871153 * @param $line Integer: the input line number, for reporting errors
10881154 */
1089 - public function addArticle( $name, $text, $line ) {
 1155+ static public function addArticle( $name, $text, $line ) {
10901156 global $wgCapitalLinks;
 1157+
 1158+ $text = self::chomp($text);
 1159+
10911160 $oldCapitalLinks = $wgCapitalLinks;
10921161 $wgCapitalLinks = true; // We only need this from SetupGlobals() See r70917#c8637
10931162
1094 - $title = Title::newFromText( $name );
 1163+ $title = Title::newFromText( self::chomp($name) );
10951164
10961165 if ( is_null( $title ) ) {
1097 - wfDie( "invalid title at line $line\n" );
 1166+ wfDie( "invalid title ('$name' => '$title') at line $line\n" );
10981167 }
10991168
11001169 $aid = $title->getArticleID( Title::GAID_FOR_UPDATE );
11011170
11021171 if ( $aid != 0 ) {
 1172+ foreach(debug_backtrace() as $bt) {
 1173+ echo "{$bt['file']}::{$bt['line']}\n";
 1174+ }
11031175 wfDie( "duplicate article '$name' at line $line\n" );
11041176 }
11051177
Index: branches/querypage-work2/phase3/maintenance/tests/RunSeleniumTests.php
@@ -5,7 +5,8 @@
66 * @ingroup Maintenance
77 * @copyright Copyright © Wikimedia Deuschland, 2009
88 * @author Hallo Welt! Medienwerkstatt GmbH
9 - * @author Markus Glaser, Dan Nessett
 9+ * @author Markus Glaser, Dan Nessett, Priyanka Dhanda
 10+ * initial idea by Daniel Kinzler
1011 *
1112 * This program is free software; you can redistribute it and/or modify
1213 * it under the terms of the GNU General Public License as published by
@@ -28,24 +29,29 @@
2930 require_once( dirname( dirname( __FILE__ ) )."/Maintenance.php" );
3031 require_once( 'PHPUnit/Framework.php' );
3132 require_once( 'PHPUnit/Extensions/SeleniumTestCase.php' );
 33+require_once( 'PHPUnit/Util/Log/JUnit.php' );
 34+require_once( dirname( __FILE__ ) . "/selenium/SeleniumServerManager.php" );
3235
33 -
3436 class SeleniumTester extends Maintenance {
3537 protected $selenium;
 38+ protected $serverManager;
 39+ protected $seleniumServerExecPath;
3640
3741 public function __construct() {
3842 parent::__construct();
3943 $this->mDescription = "Selenium Test Runner. For documentation, visit http://www.mediawiki.org/wiki/SeleniumFramework";
40 - $this->addOption( 'port', 'Port used by selenium server. Default: 4444' );
41 - $this->addOption( 'host', 'Host selenium server. Default: $wgServer . $wgScriptPath' );
42 - $this->addOption( 'testBrowser', 'The browser he used during testing. Default: firefox' );
43 - $this->addOption( 'wikiUrl', 'The Mediawiki installation to point to. Default: http://localhost' );
44 - $this->addOption( 'username', 'The login username for sunning tests. Default: empty' );
45 - $this->addOption( 'userPassword', 'The login password for running tests. Default: empty' );
46 - $this->addOption( 'seleniumConfig', 'Location of the selenium config file. Default: empty' );
 44+ $this->addOption( 'port', 'Port used by selenium server. Default: 4444', false, true );
 45+ $this->addOption( 'host', 'Host selenium server. Default: $wgServer . $wgScriptPath', false, true );
 46+ $this->addOption( 'testBrowser', 'The browser used during testing. Default: firefox', false, true );
 47+ $this->addOption( 'wikiUrl', 'The Mediawiki installation to point to. Default: http://localhost', false, true );
 48+ $this->addOption( 'username', 'The login username for sunning tests. Default: empty', false, true );
 49+ $this->addOption( 'userPassword', 'The login password for running tests. Default: empty', false, true );
 50+ $this->addOption( 'seleniumConfig', 'Location of the selenium config file. Default: empty', false, true );
4751 $this->addOption( 'list-browsers', 'List the available browsers.' );
4852 $this->addOption( 'verbose', 'Be noisier.' );
49 -
 53+ $this->addOption( 'startserver', 'Start Selenium Server (on localhost) before the run.' );
 54+ $this->addOption( 'stopserver', 'Stop Selenium Server (on localhost) after the run.' );
 55+ $this->addOption( 'jUnitLogFile', 'Log results in a specified JUnit log file.', false, true );
5056 $this->deleteOption( 'dbpass' );
5157 $this->deleteOption( 'dbuser' );
5258 $this->deleteOption( 'globals' );
@@ -62,13 +68,59 @@
6369 echo $desc;
6470 }
6571
 72+ protected function startServer() {
 73+ if ( $this->seleniumServerExecPath == '' ) {
 74+ die ( "The selenium server exec path is not set in " .
 75+ "selenium_settings.ini. Cannot start server \n" .
 76+ "as requested - terminating RunSeleniumTests\n" );
 77+ }
 78+ $this->serverManager = new SeleniumServerManager( 'true',
 79+ $this->selenium->getPort(),
 80+ $this->seleniumServerExecPath );
 81+ switch ( $this->serverManager->start() ) {
 82+ case 'started':
 83+ break;
 84+ case 'failed':
 85+ die ( "Unable to start the Selenium Server - " .
 86+ "terminating RunSeleniumTests\n" );
 87+ case 'running':
 88+ echo ( "Warning: The Selenium Server is " .
 89+ "already running\n" );
 90+ break;
 91+ }
 92+
 93+ return;
 94+ }
 95+
 96+ protected function stopServer() {
 97+ if ( !isset ( $this->serverManager ) ) {
 98+ echo ( "Warning: Request to stop Selenium Server, but it was " .
 99+ "not stared by RunSeleniumTests\n" .
 100+ "RunSeleniumTests cannot stop a Selenium Server it " .
 101+ "did not start\n" );
 102+ } else {
 103+ switch ( $this->serverManager->stop() ) {
 104+ case 'stopped':
 105+ break;
 106+ case 'failed':
 107+ echo ( "unable to stop the Selenium Server\n" );
 108+ }
 109+ }
 110+ return;
 111+ }
 112+
66113 protected function runTests( $seleniumTestSuites = array() ) {
67114 $result = new PHPUnit_Framework_TestResult;
68115 $result->addListener( new SeleniumTestListener( $this->selenium->getLogger() ) );
 116+ if ( $this->selenium->getJUnitLogFile() ) {
 117+ $jUnitListener = new PHPUnit_Util_Log_JUnit( $this->selenium->getJUnitLogFile(), true );
 118+ $result->addListener( $jUnitListener );
 119+ }
69120
70121 foreach ( $seleniumTestSuites as $testSuiteName => $testSuiteFile ) {
71 - require( $testSuiteFile );
 122+ require( $testSuiteFile );
72123 $suite = new $testSuiteName();
 124+ $suite->setName( $testSuiteName );
73125 $suite->addTests();
74126
75127 try {
@@ -78,6 +130,10 @@
79131 throw new MWException( $e->getMessage() );
80132 }
81133 }
 134+
 135+ if ( $this->selenium->getJUnitLogFile() ) {
 136+ $jUnitListener->flush();
 137+ }
82138 }
83139
84140 public function execute() {
@@ -107,6 +163,13 @@
108164 $seleniumTestSuites ) );
109165 }
110166
 167+ // State for starting/stopping the Selenium server has nothing to do with the Selenium
 168+ // class. Keep this state local to SeleniumTester class. Using getOption() is clumsy, but
 169+ // the Maintenance class does not have a setOption()
 170+ if ( isset( $seleniumSettings['startserver'] ) ) $this->getOption( 'startserver', true );
 171+ if ( isset( $seleniumSettings['stopserver'] ) ) $this->getOption( 'stopserver', true );
 172+ if ( !isset( $seleniumSettings['seleniumserverexecpath'] ) ) $seleniumSettings['seleniumserverexecpath'] = '';
 173+ $this->seleniumServerExecPath = $seleniumSettings['seleniumserverexecpath'];
111174
112175 //set reasonable defaults if we did not find the settings
113176 if ( !isset( $seleniumBrowsers ) ) $seleniumBrowsers = array ('firefox' => '*firefox');
@@ -116,7 +179,9 @@
117180 if ( !isset( $seleniumSettings['username'] ) ) $seleniumSettings['username'] = '';
118181 if ( !isset( $seleniumSettings['userPassword'] ) ) $seleniumSettings['userPassword'] = '';
119182 if ( !isset( $seleniumSettings['testBrowser'] ) ) $seleniumSettings['testBrowser'] = 'firefox';
120 -
 183+ if ( !isset( $seleniumSettings['jUnitLogFile'] ) ) $seleniumSettings['jUnitLogFile'] = false;
 184+
 185+ // Setup Selenium class
121186 $this->selenium = new Selenium( );
122187 $this->selenium->setAvailableBrowsers( $seleniumBrowsers );
123188 $this->selenium->setUrl( $this->getOption( 'wikiUrl', $seleniumSettings['wikiUrl'] ) );
@@ -126,16 +191,24 @@
127192 $this->selenium->setUser( $this->getOption( 'username', $seleniumSettings['username'] ) );
128193 $this->selenium->setPass( $this->getOption( 'userPassword', $seleniumSettings['userPassword'] ) );
129194 $this->selenium->setVerbose( $this->hasOption( 'verbose' ) );
 195+ $this->selenium->setJUnitLogFile( $this->getOption( 'jUnitLogFile', $seleniumSettings['jUnitLogFile'] ) );
130196
131197 if( $this->hasOption( 'list-browsers' ) ) {
132198 $this->listBrowsers();
133199 exit(0);
134200 }
 201+ if ( $this->hasOption( 'startserver' ) ) {
 202+ $this->startServer();
 203+ }
135204
136205 $logger = new SeleniumTestConsoleLogger;
137206 $this->selenium->setLogger( $logger );
138207
139208 $this->runTests( $seleniumTestSuites );
 209+
 210+ if ( $this->hasOption( 'stopserver' ) ) {
 211+ $this->stopServer();
 212+ }
140213 }
141214 }
142215
Property changes on: branches/querypage-work2/phase3/maintenance/tests
___________________________________________________________________
Modified: svn:mergeinfo
143216 Merged /trunk/phase3/maintenance/tests:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Index: branches/querypage-work2/phase3/maintenance/patchSql.php
@@ -39,8 +39,8 @@
4040 foreach ( $this->mArgs as $arg ) {
4141 $files = array(
4242 $arg,
43 - DatabaseBase::patchPath( $arg ),
44 - DatabaseBase::patchPath( "patch-$arg.sql" ),
 43+ $dbw->patchPath( $arg ),
 44+ $dbw->patchPath( "patch-$arg.sql" ),
4545 );
4646 foreach ( $files as $file ) {
4747 if ( file_exists( $file ) ) {
Property changes on: branches/querypage-work2/phase3/maintenance/cleanupTable.inc
___________________________________________________________________
Modified: svn:mergeinfo
4848 Merged /trunk/phase3/maintenance/cleanupTable.inc:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Index: branches/querypage-work2/phase3/maintenance/rollbackEdits.php
@@ -86,7 +86,7 @@
8787 array( 'page_latest = rev_id', 'rev_user_text' => $user ),
8888 __METHOD__
8989 );
90 - while ( $row = $dbr->fetchObject( $results ) ) {
 90+ foreach ( $results as $row ) {
9191 $titles[] = Title::makeTitle( $row->page_namespace, $row->page_title );
9292 }
9393 return $titles;
Index: branches/querypage-work2/phase3/maintenance/update.php
@@ -10,7 +10,7 @@
1111 */
1212
1313 $wgUseMasterForMaintenance = true;
14 -require_once( 'Maintenance.php' );
 14+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
1515
1616 class UpdateMediaWiki extends Maintenance {
1717
Index: branches/querypage-work2/phase3/maintenance/gearman/gearman.inc
@@ -72,7 +72,7 @@
7373 if (isset($resp['data']['arg']) &&
7474 Net_Gearman_Connection::stringLength($resp['data']['arg'])) {
7575 $arg = json_decode($resp['data']['arg'], true);
76 - }
 76+ }
7777
7878 ### START MW DIFFERENT BIT
7979 if ( $name != 'mw_job' ) {
Index: branches/querypage-work2/phase3/maintenance/language/checkLanguage.inc
@@ -444,8 +444,8 @@
445445 * @return True if there are any results, false if not.
446446 */
447447 protected function isEmpty() {
448 - foreach( $this->results as $code => $results ) {
449 - foreach( $results as $check => $messages ) {
 448+ foreach( $this->results as $results ) {
 449+ foreach( $results as $messages ) {
450450 if( !empty( $messages ) ) {
451451 return false;
452452 }
Index: branches/querypage-work2/phase3/maintenance/language/countMessages.php
@@ -38,7 +38,7 @@
3939 if ( !preg_match( '/Messages([A-Z][a-z_]+)\.php$/', $baseName, $m ) ) {
4040 continue;
4141 }
42 - $code = str_replace( '_', '-', strtolower( $m[1] ) );
 42+
4343 $numMessages = $this->getNumMessages( $file );
4444 // print "$code: $numMessages\n";
4545 $total += $numMessages;
Index: branches/querypage-work2/phase3/maintenance/userDupes.inc
@@ -190,7 +190,7 @@
191191 HAVING n > 1", $fname );
192192
193193 $list = array();
194 - while ( $row = $this->db->fetchObject( $result ) ) {
 194+ foreach ( $result as $row ) {
195195 $list[] = $row->user_name;
196196 }
197197 return $list;
@@ -215,7 +215,7 @@
216216 $firstId = $firstRow->user_id;
217217 wfOut( "Record that will be used for '$name' is user_id=$firstId\n" );
218218
219 - while ( $row = $this->db->fetchObject( $result ) ) {
 219+ foreach ( $result as $row ) {
220220 $dupeId = $row->user_id;
221221 wfOut( "... dupe id $dupeId: " );
222222 $edits = $this->editCount( $dupeId );
Index: branches/querypage-work2/phase3/maintenance/lag.php
@@ -30,7 +30,7 @@
3131 $lags = $lb->getLagTimes();
3232 unset( $lags[0] );
3333 echo gmdate( 'H:i:s' ) . ' ';
34 - foreach ( $lags as $i => $lag ) {
 34+ foreach ( $lags as $lag ) {
3535 printf( "%-12s " , $lag === false ? 'false' : $lag );
3636 }
3737 echo "\n";
Index: branches/querypage-work2/phase3/maintenance/doMaintenance.php
@@ -67,6 +67,7 @@
6868 require_once( "$IP/includes/DefaultSettings.php" );
6969
7070 $callback = MW_CONFIG_CALLBACK;
 71+ # PHP 5.1 doesn't support "class::method" for call_user_func, so split it
7172 if ( strpos( $callback, '::' ) !== false ) {
7273 $callback = explode( '::', $callback, 2);
7374 }
Index: branches/querypage-work2/phase3/maintenance/storage/compressOld.inc
@@ -18,7 +18,7 @@
1919 break;
2020 }
2121 $last = $start;
22 - while( $row = $dbw->fetchObject( $res ) ) {
 22+ foreach ( $res as $row ) {
2323 # print " {$row->old_id} - {$row->old_namespace}:{$row->old_title}\n";
2424 compressPage( $row, $extdb );
2525 $last = $row->old_id;
@@ -169,7 +169,7 @@
170170 $revLoadOptions
171171 );
172172 $revs = array();
173 - while ( $revRow = $dbw->fetchObject( $revRes ) ) {
 173+ foreach ( $revRes as $revRow ) {
174174 $revs[] = $revRow;
175175 }
176176
Index: branches/querypage-work2/phase3/maintenance/storage/moveToExternal.php
@@ -59,7 +59,7 @@
6060 "old_id BETWEEN $blockStart AND $blockEnd",
6161 'old_flags NOT ' . $dbr->buildLike( $dbr->anyString(), 'external', $dbr->anyString() ),
6262 ), $fname );
63 - while ( $row = $dbr->fetchObject( $res ) ) {
 63+ foreach ( $res as $row ) {
6464 # Resolve stubs
6565 $text = $row->old_text;
6666 $id = $row->old_id;
Index: branches/querypage-work2/phase3/maintenance/storage/resolveStubs.php
@@ -38,7 +38,7 @@
3939 "AND old_flags LIKE '%object%' AND old_flags NOT LIKE '%external%' " .
4040 'AND LOWER(CONVERT(LEFT(old_text,22) USING latin1)) = \'o:15:"historyblobstub"\'',
4141 $fname );
42 - while ( $row = $dbr->fetchObject( $res ) ) {
 42+ foreach ( $res as $row ) {
4343 resolveStub( $row->old_id, $row->old_text, $row->old_flags );
4444 }
4545 }
Index: branches/querypage-work2/phase3/maintenance/storage/checkStorage.php
@@ -70,7 +70,7 @@
7171 $dbr->ping();
7272 $res = $dbr->select( 'revision', array( 'rev_id', 'rev_text_id' ),
7373 array( "rev_id BETWEEN $chunkStart AND $chunkEnd" ), $fname );
74 - while ( $row = $dbr->fetchObject( $res ) ) {
 74+ foreach ( $res as $row ) {
7575 $this->oldIdMap[$row->rev_id] = $row->rev_text_id;
7676 }
7777 $dbr->freeResult( $res );
@@ -85,7 +85,7 @@
8686 $objectRevs = array();
8787 $res = $dbr->select( 'text', array( 'old_id', 'old_flags' ),
8888 'old_id IN (' . implode( ',', $this->oldIdMap ) . ')', $fname );
89 - while ( $row = $dbr->fetchObject( $res ) ) {
 89+ foreach ( $res as $row ) {
9090 $flags = $row->old_flags;
9191 $id = $row->old_id;
9292
@@ -139,7 +139,7 @@
140140 if ( count( $externalRevs ) ) {
141141 $res = $dbr->select( 'text', array( 'old_id', 'old_flags', 'old_text' ),
142142 array( 'old_id IN (' . implode( ',', $externalRevs ) . ')' ), $fname );
143 - while ( $row = $dbr->fetchObject( $res ) ) {
 143+ foreach ( $res as $row ) {
144144 $urlParts = explode( '://', $row->old_text, 2 );
145145 if ( count( $urlParts ) !== 2 || $urlParts[1] == '' ) {
146146 $this->error( 'restore text', "Error: invalid URL \"{$row->old_text}\"", $row->old_id );
@@ -177,7 +177,7 @@
178178 $res = $extDb->select( $blobsTable,
179179 array( 'blob_id' ),
180180 array( 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ), $fname );
181 - while ( $row = $extDb->fetchObject( $res ) ) {
 181+ foreach ( $res as $row ) {
182182 unset( $xBlobIds[$row->blob_id] );
183183 }
184184 $extDb->freeResult( $res );
@@ -196,7 +196,7 @@
197197 $headerLength = 300;
198198 $res = $dbr->select( 'text', array( 'old_id', 'old_flags', "LEFT(old_text, $headerLength) AS header" ),
199199 array( 'old_id IN (' . implode( ',', $objectRevs ) . ')' ), $fname );
200 - while ( $row = $dbr->fetchObject( $res ) ) {
 200+ foreach ( $res as $row ) {
201201 $oldId = $row->old_id;
202202 $matches = array();
203203 if ( !preg_match( '/^O:(\d+):"(\w+)"/', $row->header, $matches ) ) {
@@ -247,7 +247,7 @@
248248 $headerLength = 300;
249249 $res = $dbr->select( 'text', array( 'old_id', 'old_flags', "LEFT(old_text, $headerLength) AS header" ),
250250 array( 'old_id IN (' . implode( ',', array_keys( $concatBlobs ) ) . ')' ), $fname );
251 - while ( $row = $dbr->fetchObject( $res ) ) {
 251+ foreach ( $res as $row ) {
252252 $flags = explode( ',', $row->old_flags );
253253 if ( in_array( 'external', $flags ) ) {
254254 // Concat blob is in external storage?
@@ -355,7 +355,7 @@
356356 $res = $extDb->select( $blobsTable,
357357 array( 'blob_id', "LEFT(blob_text, $headerLength) AS header" ),
358358 array( 'blob_id IN( ' . implode( ',', $blobIds ) . ')' ), $fname );
359 - while ( $row = $extDb->fetchObject( $res ) ) {
 359+ foreach ( $res as $row ) {
360360 if ( strcasecmp( $row->header, CONCAT_HEADER ) ) {
361361 $this->error( 'restore text', "Error: invalid header on target $cluster/{$row->blob_id} of two-part ES URL",
362362 $oldIds[$row->blob_id] );
Index: branches/querypage-work2/phase3/maintenance/nextJobDB.php
@@ -64,7 +64,7 @@
6565 $dbsByMaster[$lb->getServerName( 0 )][] = $db;
6666 }
6767
68 - foreach ( $dbsByMaster as $master => $dbs ) {
 68+ foreach ( $dbsByMaster as $dbs ) {
6969 $dbConn = wfGetDB( DB_MASTER, array(), $dbs[0] );
7070 $stype = $dbConn->addQuotes( $type );
7171
Index: branches/querypage-work2/phase3/maintenance/oracle/tables.sql
@@ -127,8 +127,8 @@
128128 );
129129 CREATE INDEX &mw_prefix.archive_i01 ON &mw_prefix.archive (ar_namespace,ar_title,ar_timestamp);
130130 CREATE INDEX &mw_prefix.archive_i02 ON &mw_prefix.archive (ar_user_text,ar_timestamp);
 131+CREATE INDEX &mw_prefix.archive_i03 ON &mw_prefix.archive (ar_namespace, ar_title, ar_rev_id);
131132
132 -
133133 CREATE TABLE &mw_prefix.pagelinks (
134134 pl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
135135 pl_namespace NUMBER NOT NULL,
@@ -156,12 +156,16 @@
157157 CREATE TABLE &mw_prefix.categorylinks (
158158 cl_from NUMBER NOT NULL REFERENCES &mw_prefix.page(page_id) ON DELETE CASCADE,
159159 cl_to VARCHAR2(255) NOT NULL,
160 - cl_sortkey VARCHAR2(255),
161 - cl_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
 160+ cl_sortkey VARCHAR2(230),
 161+ cl_sortkey_prefix VARCHAR2(255) DEFAULT '' NOT NULL,
 162+ cl_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL,
 163+ cl_collation VARCHAR2(32) DEFAULT '' NOT NULL,
 164+ cl_type VARCHAR2(6) DEFAULT 'page' NOT NULL
162165 );
163166 CREATE UNIQUE INDEX &mw_prefix.categorylinks_u01 ON &mw_prefix.categorylinks (cl_from,cl_to);
164 -CREATE INDEX &mw_prefix.categorylinks_i01 ON &mw_prefix.categorylinks (cl_to,cl_sortkey,cl_from);
 167+CREATE INDEX &mw_prefix.categorylinks_i01 ON &mw_prefix.categorylinks (cl_to,cl_type,cl_sortkey,cl_from);
165168 CREATE INDEX &mw_prefix.categorylinks_i02 ON &mw_prefix.categorylinks (cl_to,cl_timestamp);
 169+CREATE INDEX &mw_prefix.categorylinks_i03 ON &mw_prefix.categorylinks (cl_collation);
166170
167171 CREATE SEQUENCE category_cat_id_seq;
168172 CREATE TABLE &mw_prefix.category (
@@ -200,6 +204,14 @@
201205 CREATE UNIQUE INDEX &mw_prefix.langlinks_u01 ON &mw_prefix.langlinks (ll_from, ll_lang);
202206 CREATE INDEX &mw_prefix.langlinks_i01 ON &mw_prefix.langlinks (ll_lang, ll_title);
203207
 208+CREATE TABLE &mw_prefix.iwlinks (
 209+ iwl_from NUMBER DEFAULT 0 NOT NULL,
 210+ iwl_prefix VARCHAR2(20) DEFAULT '' NOT NULL,
 211+ iwl_title VARCHAR2(255) DEFAULT '' NOT NULL
 212+);
 213+CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui01 ON &mw_prefix.iwlinks (iwl_from, iwl_prefix, iwl_title);
 214+CREATE UNIQUE INDEX &mw_prefix.iwlinks_ui02 ON &mw_prefix.iwlinks (iwl_prefix, iwl_title, iwl_from);
 215+
204216 CREATE TABLE &mw_prefix.site_stats (
205217 ss_row_id NUMBER NOT NULL ,
206218 ss_total_views NUMBER DEFAULT 0,
@@ -388,6 +400,8 @@
389401 CREATE TABLE &mw_prefix.interwiki (
390402 iw_prefix VARCHAR2(32) NOT NULL,
391403 iw_url VARCHAR2(127) NOT NULL,
 404+ iw_api BLOB NOT NULL,
 405+ iw_wikiid VARCHAR2(64),
392406 iw_local CHAR(1) NOT NULL,
393407 iw_trans CHAR(1) DEFAULT '0' NOT NULL
394408 );
@@ -531,7 +545,8 @@
532546
533547
534548 CREATE TABLE &mw_prefix.updatelog (
535 - ul_key VARCHAR2(255) NOT NULL
 549+ ul_key VARCHAR2(255) NOT NULL,
 550+ ul_value BLOB
536551 );
537552 ALTER TABLE &mw_prefix.updatelog ADD CONSTRAINT &mw_prefix.updatelog_pk PRIMARY KEY (ul_key);
538553
@@ -581,6 +596,27 @@
582597 );
583598 CREATE INDEX &mw_prefix.l10n_cache_u01 ON &mw_prefix.l10n_cache (lc_lang, lc_key);
584599
 600+CREATE TABLE &mw_prefix.msg_resource (
 601+ mr_resource VARCHAR2(255) NOT NULL,
 602+ mr_lang varchar2(32) NOT NULL,
 603+ mr_blob BLOB NOT NULL,
 604+ mr_timestamp TIMESTAMP(6) WITH TIME ZONE NOT NULL
 605+) ;
 606+CREATE UNIQUE INDEX &mw_prefix.msg_resource_u01 ON &mw_prefix.msg_resource (mr_resource, mr_lang);
 607+
 608+CREATE TABLE &mw_prefix.msg_resource_links (
 609+ mrl_resource VARCHAR2(255) NOT NULL,
 610+ mrl_message VARCHAR2(255) NOT NULL
 611+);
 612+CREATE UNIQUE INDEX &mw_prefix.msg_resource_links_u01 ON &mw_prefix.msg_resource_links (mrl_message, mrl_resource);
 613+
 614+CREATE TABLE &mw_prefix.module_deps (
 615+ md_module VARCHAR2(255) NOT NULL,
 616+ md_skin VARCHAR2(32) NOT NULL,
 617+ md_deps BLOB NOT NULL
 618+);
 619+CREATE UNIQUE INDEX &mw_prefix.module_deps_u01 ON &mw_prefix.module_deps (md_module, md_skin);
 620+
585621 -- do not prefix this table as it breaks parserTests
586622 CREATE TABLE wiki_field_info_full (
587623 table_name VARCHAR2(35) NOT NULL,
Index: branches/querypage-work2/phase3/maintenance/oracle/user.sql
@@ -1,8 +1,8 @@
22 -- defines must comply with ^define\s*([^\s=]*)\s*=\s?'\{\$([^\}]*)\}';
33 define wiki_user='{$wgDBuser}';
44 define wiki_pass='{$wgDBpassword}';
5 -define def_ts='{$wgDBOracleDefTS}';
6 -define temp_ts='{$wgDBOracleTempTS}';
 5+define def_ts='{$_OracleDefTS}';
 6+define temp_ts='{$_OracleTempTS}';
77
88 create user &wiki_user. identified by &wiki_pass. default tablespace &def_ts. temporary tablespace &temp_ts. quota unlimited on &def_ts.;
99 grant connect, resource to &wiki_user.;
Index: branches/querypage-work2/phase3/maintenance/convertLinks.php
@@ -113,7 +113,7 @@
114114 $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" );
115115 $ids = array();
116116
117 - while ( $row = $dbw->fetchObject( $res ) ) {
 117+ foreach ( $res as $row ) {
118118 $title = $row->cur_title;
119119 if ( $row->cur_namespace ) {
120120 $title = $wgContLang->getNsText( $row->cur_namespace ) . ":$title";
@@ -154,7 +154,7 @@
155155 }
156156
157157 $tuplesAdded = 0; # no tuples added to INSERT yet
158 - while ( $row = $dbw->fetchObject( $res ) ) {
 158+ foreach ( $res as $row ) {
159159 $fromTitle = $row->l_from;
160160 if ( array_key_exists( $fromTitle, $ids ) ) { # valid title
161161 $from = $ids[$fromTitle];
Index: branches/querypage-work2/phase3/maintenance/deleteSelfExternals.php
@@ -24,7 +24,7 @@
2525 * @ingroup Maintenance
2626 */
2727
28 -require_once( "Maintenance.php" );
 28+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
2929
3030
3131 class DeleteSelfExternals extends Maintenance {
@@ -45,7 +45,7 @@
4646 . $db->buildLike( $wgServer . '/', $db->anyString() ), $this->mBatchSize );
4747 $this->output( "Deleting a batch\n" );
4848 $db->query( $q );
49 - if ( !$db->affectedRows() ) exit( 0 );
 49+ if ( !$db->affectedRows() ) return;
5050 }
5151 }
5252 }
Property changes on: branches/querypage-work2/phase3/maintenance/deleteSelfExternals.php
___________________________________________________________________
Modified: svn:mergeinfo
5353 Merged /trunk/phase3/maintenance/deleteSelfExternals.php:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Property changes on: branches/querypage-work2/phase3/maintenance/populateRevisionLength.php
___________________________________________________________________
Modified: svn:mergeinfo
5454 Merged /trunk/phase3/maintenance/populateRevisionLength.php:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Index: branches/querypage-work2/phase3/maintenance/userOptions.inc
@@ -111,7 +111,7 @@
112112 __METHOD__
113113 );
114114
115 - while ( $id = $dbr->fetchObject( $result ) ) {
 115+ foreach ( $result as $id ) {
116116
117117 $user = User::newFromId( $id->user_id );
118118
@@ -161,7 +161,7 @@
162162 __METHOD__
163163 );
164164
165 - while ( $id = $dbr->fetchObject( $result ) ) {
 165+ foreach ( $result as $id ) {
166166
167167 $user = User::newFromId( $id->user_id );
168168
Index: branches/querypage-work2/phase3/maintenance/archives/patch-categorylinks-better-collation.sql
@@ -5,7 +5,7 @@
66 -- changes are also incorporated into patch-categorylinks-better-collation2.sql,
77 -- for the benefit of trunk users who applied the original.
88 ALTER TABLE /*$wgDBprefix*/categorylinks
9 - CHANGE COLUMN cl_sortkey cl_sortkey varbinary(255) NOT NULL default '',
 9+ CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '',
1010 ADD COLUMN cl_sortkey_prefix varchar(255) binary NOT NULL default '',
1111 ADD COLUMN cl_collation varbinary(32) NOT NULL default '',
1212 ADD COLUMN cl_type ENUM('page', 'subcat', 'file') NOT NULL default 'page',
Index: branches/querypage-work2/phase3/maintenance/archives/patch-categorylinks-better-collation2.sql
@@ -7,6 +7,6 @@
88 -- large table unnecessarily for people upgrading from 1.16, so this will be
99 -- skipped if unneeded.
1010 ALTER TABLE /*$wgDBprefix*/categorylinks
11 - CHANGE COLUMN cl_sortkey cl_sortkey varbinary(255) NOT NULL default '',
 11+ CHANGE COLUMN cl_sortkey cl_sortkey varbinary(230) NOT NULL default '',
1212 CHANGE COLUMN cl_collation cl_collation varbinary(32) NOT NULL default '';
1313 INSERT IGNORE INTO /*$wgDBprefix*/updatelog (ul_key) VALUES ('cl_fields_update');
Property changes on: branches/querypage-work2/phase3/maintenance/archives
___________________________________________________________________
Modified: svn:mergeinfo
1414 Merged /trunk/phase3/maintenance/archives:r74568,74575,74577-74581,74584-74585,74587,74589,74591,74595-74596,74606-74607,74614,74625,74627-74628,74643,74646,74677,74679,74681-74684,74686,74688,74691-74692,74695,74697,74703-74704,74725,74727,74731,74740,74742-74750,74752-74753,74755,74771,74778,74780,74784,74786-74787,74789-74790,74792,74795-74798,74800,74804,74806,74810,74820-74822,74824-74825,74827,74831-74832,74836-74837,74841,74843,74847,74849-74851,74855,74859,74884,74891,74896,74898-74899,74901-74902,74904,74910-74914,74918-74920,74922,74932,74934,74943-74957,74959,74962,74964,74966,74969,74975,74978,74981,74988,75002-75003,75006,75018-75019,75021-75022,75024-75025,75029-75031,75035-75037,75040,75054-75057,75059-75061,75064,75066,75068,75083-75084,75087-75088,75096,75098,75100,75102
Index: branches/querypage-work2/phase3/maintenance/initEditCount.php
@@ -1,5 +1,8 @@
22 <?php
33 /**
 4+ * Init the user_editcount database field based on the number of rows in the
 5+ * revision table.
 6+ *
47 * This program is free software; you can redistribute it and/or modify
58 * it under the terms of the GNU General Public License as published by
69 * the Free Software Foundation; either version 2 of the License, or
@@ -15,6 +18,7 @@
1619 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1720 * http://www.gnu.org/copyleft/gpl.html
1821 *
 22+ * @file
1923 * @ingroup Maintenance
2024 */
2125
@@ -30,12 +34,11 @@
3135
3236 Background mode will be automatically used if the server is MySQL 4.0
3337 (which does not support subqueries) or if multiple servers are listed
34 -in $wgDBservers, usually indicating a replication environment.' );
 38+in the load balancer, usually indicating a replication environment.' );
3539 $this->mDescription = "Batch-recalculate user_editcount fields from the revision table";
3640 }
3741
3842 public function execute() {
39 - global $wgDBservers;
4043 $dbw = wfGetDB( DB_MASTER );
4144 $user = $dbw->tableName( 'user' );
4245 $revision = $dbw->tableName( 'revision' );
@@ -43,7 +46,7 @@
4447 $dbver = $dbw->getServerVersion();
4548
4649 // Autodetect mode...
47 - $backgroundMode = count( $wgDBservers ) > 1 ||
 50+ $backgroundMode = wfGetLB()->getServerCount() > 1 ||
4851 ( $dbw instanceof DatabaseMysql && version_compare( $dbver, '4.1' ) < 0 );
4952
5053 if ( $this->hasOption( 'background' ) ) {
Index: branches/querypage-work2/phase3/maintenance/install-utils.inc
@@ -191,7 +191,8 @@
192192
193193 function archive( $name ) {
194194 wfDeprecated( __METHOD__ );
195 - return DatabaseBase::patchPath( $name );
 195+ $dbr = wfGetDB( DB_SLAVE );
 196+ return $dbr->patchPath( $name );
196197 }
197198
198199 /**
Index: branches/querypage-work2/phase3/maintenance/renameDbPrefix.php
@@ -71,7 +71,7 @@
7272 // sort of message. Best not to try $row->x stuff...
7373 $fields = get_object_vars( $row );
7474 // Silly for loop over one field...
75 - foreach ( $fields as $resName => $table ) {
 75+ foreach ( $fields as $table ) {
7676 // $old should be regexp safe ([a-zA-Z_])
7777 $newTable = preg_replace( '/^' . $old . '/', $new, $table );
7878 $this->output( "Renaming table $table to $newTable\n" );
Index: branches/querypage-work2/phase3/maintenance/dumpInterwiki.php
@@ -125,7 +125,7 @@
126126 if ( preg_match( '/^\|\s*(.*?)\s*\|\|\s*(.*?)\s*$/', $line, $matches ) ) {
127127 $prefix = $wgContLang->lc( $matches[1] );
128128 $prefix = str_replace( ' ', '_', $prefix );
129 - $prefix = strtolower( $matches[1] );
 129+
130130 $url = $matches[2];
131131 if ( preg_match( '/(wikipedia|wiktionary|wikisource|wikiquote|wikibooks|wikimedia)\.org/', $url ) ) {
132132 $local = 1;
@@ -148,7 +148,6 @@
149149 $this->makeLanguageLinks ( $site, "_" . $site->suffix );
150150 }
151151
152 -
153152 foreach ( $dblist as $db ) {
154153 if ( isset( $this->specials[$db] ) ) {
155154 # Special wiki
Index: branches/querypage-work2/phase3/maintenance/populateSha1.php
@@ -52,7 +52,6 @@
5353 $res = $dbw->select( 'image', array( 'img_name' ), array( 'img_sha1' => '' ), __METHOD__ );
5454 }
5555 $imageTable = $dbw->tableName( 'image' );
56 - $oldimageTable = $dbw->tableName( 'oldimage' );
5756
5857 if ( $method == 'pipe' ) {
5958 // @fixme kill this and replace with a second unbuffered DB connection.

Follow-up revisions

RevisionCommit summaryAuthorDate
r75112Followup r75111, merge in the rest of the branch... 74568-75102reedy21:25, 20 October 2010

Status & tagging log