From ca32f08966f1b51fcb19460f0996bb0c4048e6fe Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 13:29:22 +0100 Subject: Update to MediaWiki 1.18.0 * also update ArchLinux skin to chagnes in MonoBook * Use only css to hide our menu bar when printing --- maintenance/fuzz-tester.php | 115 ++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 48 deletions(-) (limited to 'maintenance/fuzz-tester.php') diff --git a/maintenance/fuzz-tester.php b/maintenance/fuzz-tester.php index a78522cd..18af4de4 100644 --- a/maintenance/fuzz-tester.php +++ b/maintenance/fuzz-tester.php @@ -1,10 +1,28 @@ params = array ( "title" => "Special:Prefixindex", - "namespace" => wikiFuzz::randnum( -10, 101 ), + "namespace" => wikiFuzz::randnum( 101, -10 ), "Go" => wikiFuzz::makeFuzz( 2 ) ); // sometimes we want 'prefix', sometimes we want 'from', and sometimes we want nothing. if ( wikiFuzz::randnum( 3 ) == 0 ) { $this->params["prefix"] = wikiFuzz::chooseInput( array( "-1", "-----'--------0", "+++--+1", - wikiFuzz::randnum( -10, 8134 ), wikiFuzz::makeFuzz( 2 ) ) ); + wikiFuzz::randnum( 8134, -10 ), wikiFuzz::makeFuzz( 2 ) ) ); } if ( wikiFuzz::randnum( 3 ) == 0 ) { $this->params["from"] = wikiFuzz::chooseInput( array( "-1", "-----'--------0", "+++--+1", - wikiFuzz::randnum( -10, 8134 ), wikiFuzz::makeFuzz( 2 ) ) ); + wikiFuzz::randnum( 8134, -10 ), wikiFuzz::makeFuzz( 2 ) ) ); } } } @@ -1350,7 +1369,7 @@ class viewPageTest extends pageTest { // Tidy does not know how to valid atom or rss, so exclude from testing for the time being. if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); } - else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } + elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } // Raw pages cannot really be validated if ( $this->params["action"] == "raw" ) unset( $this->params["action"] ); @@ -1384,7 +1403,7 @@ class specialAllmessagesTest extends pageTest { /** ** a page test for "Special:Newpages". */ -class specialNewpages extends pageTest { +class specialNewpagesPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Newpages"; @@ -1397,7 +1416,7 @@ class specialNewpages extends pageTest { // Tidy does not know how to valid atom or rss, so exclude from testing for the time being. if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); } - else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } + elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); } } } @@ -1470,7 +1489,7 @@ class specialBlockmeTest extends pageTest { // sometimes we specify "ip", and sometimes we don't. if ( wikiFuzz::randnum( 1 ) == 0 ) { - $this->params["ip"] = wikiFuzz::chooseInput( array( "10.12.41.213", wikiFuzz::randnum( -10, 8134 ), wikiFuzz::makeFuzz( 2 ) ) ); + $this->params["ip"] = wikiFuzz::chooseInput( array( "10.12.41.213", wikiFuzz::randnum( 8134, -10 ), wikiFuzz::makeFuzz( 2 ) ) ); } } } @@ -1512,7 +1531,7 @@ class specialMovePage extends pageTest { /** ** a page test for "Special:Undelete" */ -class specialUndelete extends pageTest { +class specialUndeletePageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Undelete"; @@ -1539,7 +1558,7 @@ class specialUndelete extends pageTest { /** ** a page test for "Special:Unlockdb" */ -class specialUnlockdb extends pageTest { +class specialUnlockdbPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Unlockdb"; @@ -1560,7 +1579,7 @@ class specialUnlockdb extends pageTest { /** ** a page test for "Special:Lockdb" */ -class specialLockdb extends pageTest { +class specialLockdbPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Lockdb"; @@ -1713,7 +1732,7 @@ class pageDeletion extends pageTest { /** ** a test for Revision Deletion. */ -class specialRevisionDelete extends pageTest { +class specialRevisionDeletePageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Revisiondelete"; @@ -1744,7 +1763,7 @@ class specialRevisionDelete extends pageTest { /** ** a test for Special:Import. */ -class specialImport extends pageTest { +class specialImportPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Import"; @@ -1842,7 +1861,7 @@ class profileInfo extends pageTest { /** ** a test for Special:Cite (extension Special page). */ -class specialCite extends pageTest { +class specialCitePageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Cite"; @@ -1861,7 +1880,7 @@ class specialCite extends pageTest { /** ** a test for Special:Filepath (extension Special page). */ -class specialFilepath extends pageTest { +class specialFilepathPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Filepath"; @@ -1921,7 +1940,7 @@ class specialMakesysop extends pageTest { /** ** a test for Special:Renameuser (extension Special page). */ -class specialRenameuser extends pageTest { +class specialRenameuserPageTest extends pageTest { function __construct() { $this->pagePath = "index.php?title=Special:Renameuser"; @@ -2044,18 +2063,18 @@ class api extends pageTest { // API watchlist feed mode. private static function feedwatchlistMode() { - // FIXME: add "wikiFuzz::makeFuzz(2)" as possible value below? + // @todo FIXME: Add "wikiFuzz::makeFuzz(2)" as possible value below? return array ( "feedformat" => wikiFuzz::chooseInput( array( "rss", "atom" ) ) ); } // API query mode. private static function queryMode() { - // FIXME: add "wikiFuzz::makeFuzz(2)" as possible params for the elements below? + // @todo FIXME: Add "wikiFuzz::makeFuzz(2)" as possible params for the elements below? // Suspect this will stuff up the tests more, but need to check. $params = array ( - // FIXME: More titles. + // @todo FIXME: More titles. "titles" => wikiFuzz::chooseInput( array( "Main Page" ) ), - // FIXME: More pageids. + // @todo FIXME: More pageids. "pageids" => 1, "prop" => wikiFuzz::chooseInput( array( "info", "revisions", "watchlist" ) ), "list" => wikiFuzz::chooseInput( array( "allpages", "logevents", "watchlist", "usercontribs", "recentchanges", "backlinks", "embeddedin", "imagelinks" ) ), @@ -2149,7 +2168,7 @@ class api extends pageTest { $this->params["action"] = $action; // Set the cookie: - // FIXME: need to get this cookie dynamically set, rather than hard-coded. + // @todo FIXME: Need to get this cookie dynamically set, rather than hard-coded. $this->cookie = "wikidbUserID=10001; wikidbUserName=Test; wikidb_session=178df0fe68c75834643af65dec9ec98a; wikidbToken=1adc6753d62c44aec950c024d7ae0540"; // Output format @@ -2173,7 +2192,7 @@ class GeSHi_Test extends pageTest { return "getLang() . "\" " . ( wikiFuzz::randnum( 2 ) == 0 ? "line " : "" ) . ( wikiFuzz::randnum( 2 ) == 0 ? "strict " : "" ) - . "start=" . wikiFuzz::chooseInput( array( wikiFuzz::randnum( -6000, 6000 ), wikiFuzz::makeFuzz( 2 ) ) ) + . "start=" . wikiFuzz::chooseInput( array( wikiFuzz::randnum( 6000, -6000 ), wikiFuzz::makeFuzz( 2 ) ) ) . ">" . wikiFuzz::makeFuzz( 2 ) . ""; @@ -2238,31 +2257,31 @@ function selectPageTest( $count ) { case 15: return new contributionsTest(); case 16: return new viewPageTest(); case 17: return new specialAllmessagesTest(); - case 18: return new specialNewpages(); + case 18: return new specialNewpagesPageTest(); case 19: return new searchTest(); case 20: return new redirectTest(); case 21: return new confirmEmail(); case 22: return new watchlistTest(); case 23: return new specialBlockmeTest(); - case 24: return new specialUndelete(); + case 24: return new specialUndeletePageTest(); case 25: return new specialMovePage(); - case 26: return new specialUnlockdb(); - case 27: return new specialLockdb(); + case 26: return new specialUnlockdbPageTest(); + case 27: return new specialLockdbPageTest(); case 28: return new specialUserrights(); case 29: return new pageProtectionForm(); case 30: return new specialBlockip(); case 31: return new imagepageTest(); case 32: return new pageDeletion(); - case 33: return new specialRevisionDelete(); - case 34: return new specialImport(); + case 33: return new specialRevisionDeletePageTest(); + case 34: return new specialImportPageTest(); case 35: return new thumbTest(); case 36: return new trackbackTest(); case 37: return new profileInfo(); - case 38: return new specialCite(); - case 39: return new specialFilepath(); + case 38: return new specialCitePageTest(); + case 39: return new specialFilepathPageTest(); case 40: return new specialMakebot(); case 41: return new specialMakesysop(); - case 42: return new specialRenameuser(); + case 42: return new specialRenameuserPageTest(); case 43: return new specialLinksearch(); case 44: return new specialCategoryTree(); case 45: return new api(); @@ -2333,7 +2352,7 @@ function saveTestAsPHP( pageTest $test, $filename ) { . "\$result=curl_exec(\$ch);\n" . "curl_close (\$ch);\n" . "print \$result;\n" - . "?>\n"; + . "\n"; saveFile( $str, $filename ); } @@ -2453,7 +2472,7 @@ function validateHTML( $text ) { curl_close ( $ch ); - $valid = ( strpos( $result, "Failed validation" ) === false ? true : false ); + $valid = ( strpos( $result, "Failed validation" ) === false ); return array( $valid, $result ); } @@ -2490,8 +2509,8 @@ function dbErrorLogged() { // first time running this function if ( !isset( $filesize ) ) { // create log if it does not exist - if ( !file_exists( DB_ERROR_LOG_FILE ) ) { - saveFile( "", DB_ERROR_LOG_FILE ); + if ( DB_ERROR_LOG_FILE && !file_exists( DB_ERROR_LOG_FILE ) ) { + saveFile( '', DB_ERROR_LOG_FILE ); } $filesize = filesize( DB_ERROR_LOG_FILE ); return false; @@ -2683,7 +2702,7 @@ if ( !is_dir( DIRECTORY ) ) { mkdir ( DIRECTORY, 0700 ); } // otherwise, we first retest the things that we have found in previous runs -else if ( RERUN_OLD_TESTS ) { +elseif ( RERUN_OLD_TESTS ) { rerunPreviousTests(); } @@ -2731,7 +2750,7 @@ for ( $count = 0; true; $count++ ) { } saveTest( $test, $testname ); $num_errors += 1; - } else if ( KEEP_PASSED_TESTS ) { + } elseif ( KEEP_PASSED_TESTS ) { // print current time, with microseconds (matches "strace" format), and the test name. print " " . date( "H:i:s." ) . substr( current( explode( " ", microtime() ) ), 2 ) . " " . $testname; saveTest( $test, $testname ); -- cgit v1.2.2