Index: branches/REL1_18/phase3/maintenance/install.php |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); |
| 31 | +define( 'MEDIAWIKI_INSTALL', true ); |
31 | 32 | |
32 | 33 | require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" ); |
33 | 34 | |
Index: branches/REL1_18/phase3/tests/phpunit/includes/libs/IEUrlExtensionTest.php |
— | — | @@ -0,0 +1,118 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Tests for IEUrlExtension::findIE6Extension |
| 6 | + */ |
| 7 | +class IEUrlExtensionTest extends MediaWikiTestCase { |
| 8 | + function testSimple() { |
| 9 | + $this->assertEquals( |
| 10 | + 'y', |
| 11 | + IEUrlExtension::findIE6Extension( 'x.y' ), |
| 12 | + 'Simple extension' |
| 13 | + ); |
| 14 | + } |
| 15 | + |
| 16 | + function testSimpleNoExt() { |
| 17 | + $this->assertEquals( |
| 18 | + '', |
| 19 | + IEUrlExtension::findIE6Extension( 'x' ), |
| 20 | + 'No extension' |
| 21 | + ); |
| 22 | + } |
| 23 | + |
| 24 | + function testEmpty() { |
| 25 | + $this->assertEquals( |
| 26 | + '', |
| 27 | + IEUrlExtension::findIE6Extension( '' ), |
| 28 | + 'Empty string' |
| 29 | + ); |
| 30 | + } |
| 31 | + |
| 32 | + function testQuestionMark() { |
| 33 | + $this->assertEquals( |
| 34 | + '', |
| 35 | + IEUrlExtension::findIE6Extension( '?' ), |
| 36 | + 'Question mark only' |
| 37 | + ); |
| 38 | + } |
| 39 | + |
| 40 | + function testExtQuestionMark() { |
| 41 | + $this->assertEquals( |
| 42 | + 'x', |
| 43 | + IEUrlExtension::findIE6Extension( '.x?' ), |
| 44 | + 'Extension then question mark' |
| 45 | + ); |
| 46 | + } |
| 47 | + |
| 48 | + function testQuestionMarkExt() { |
| 49 | + $this->assertEquals( |
| 50 | + 'x', |
| 51 | + IEUrlExtension::findIE6Extension( '?.x' ), |
| 52 | + 'Question mark then extension' |
| 53 | + ); |
| 54 | + } |
| 55 | + |
| 56 | + function testInvalidChar() { |
| 57 | + $this->assertEquals( |
| 58 | + '', |
| 59 | + IEUrlExtension::findIE6Extension( '.x*' ), |
| 60 | + 'Extension with invalid character' |
| 61 | + ); |
| 62 | + } |
| 63 | + |
| 64 | + function testInvalidCharThenExtension() { |
| 65 | + $this->assertEquals( |
| 66 | + 'x', |
| 67 | + IEUrlExtension::findIE6Extension( '*.x' ), |
| 68 | + 'Invalid character followed by an extension' |
| 69 | + ); |
| 70 | + } |
| 71 | + |
| 72 | + function testMultipleQuestionMarks() { |
| 73 | + $this->assertEquals( |
| 74 | + 'c', |
| 75 | + IEUrlExtension::findIE6Extension( 'a?b?.c?.d?e?f' ), |
| 76 | + 'Multiple question marks' |
| 77 | + ); |
| 78 | + } |
| 79 | + |
| 80 | + function testExeException() { |
| 81 | + $this->assertEquals( |
| 82 | + 'd', |
| 83 | + IEUrlExtension::findIE6Extension( 'a?b?.exe?.d?.e' ), |
| 84 | + '.exe exception' |
| 85 | + ); |
| 86 | + } |
| 87 | + |
| 88 | + function testExeException2() { |
| 89 | + $this->assertEquals( |
| 90 | + 'exe', |
| 91 | + IEUrlExtension::findIE6Extension( 'a?b?.exe' ), |
| 92 | + '.exe exception 2' |
| 93 | + ); |
| 94 | + } |
| 95 | + |
| 96 | + function testHash() { |
| 97 | + $this->assertEquals( |
| 98 | + '', |
| 99 | + IEUrlExtension::findIE6Extension( 'a#b.c' ), |
| 100 | + 'Hash character preceding extension' |
| 101 | + ); |
| 102 | + } |
| 103 | + |
| 104 | + function testHash2() { |
| 105 | + $this->assertEquals( |
| 106 | + '', |
| 107 | + IEUrlExtension::findIE6Extension( 'a?#b.c' ), |
| 108 | + 'Hash character preceding extension 2' |
| 109 | + ); |
| 110 | + } |
| 111 | + |
| 112 | + function testDotAtEnd() { |
| 113 | + $this->assertEquals( |
| 114 | + '', |
| 115 | + IEUrlExtension::findIE6Extension( '.' ), |
| 116 | + 'Dot at end of string' |
| 117 | + ); |
| 118 | + } |
| 119 | +} |
Property changes on: branches/REL1_18/phase3/tests/phpunit/includes/libs/IEUrlExtensionTest.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 120 | + native |
Index: branches/REL1_18/phase3/includes/json/Services_JSON.php |
— | — | @@ -870,7 +870,12 @@ |
871 | 871 | function Services_JSON_Error($message = 'unknown error', $code = null, |
872 | 872 | $mode = null, $options = null, $userinfo = null) |
873 | 873 | { |
874 | | - |
| 874 | + $this->message = $message; |
875 | 875 | } |
| 876 | + |
| 877 | + function __toString() |
| 878 | + { |
| 879 | + return $this->message; |
| 880 | + } |
876 | 881 | } |
877 | 882 | } |
Property changes on: branches/REL1_18/phase3/includes/json/Services_JSON.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
878 | 883 | Merged /trunk/phase3/includes/json/Services_JSON.php:r89401,89451,89512-89513,89523,89529,89532,89549,89553,89559,89574,89598 |
Index: branches/REL1_18/phase3/includes/installer/DatabaseUpdater.php |
— | — | @@ -66,6 +66,7 @@ |
67 | 67 | $this->maintenance = new FakeMaintenance; |
68 | 68 | } |
69 | 69 | $this->initOldGlobals(); |
| 70 | + $this->loadExtensions(); |
70 | 71 | wfRunHooks( 'LoadExtensionSchemaUpdates', array( $this ) ); |
71 | 72 | } |
72 | 73 | |
— | — | @@ -88,6 +89,25 @@ |
89 | 90 | } |
90 | 91 | |
91 | 92 | /** |
| 93 | + * Loads LocalSettings.php, if needed, and initialises everything needed for LoadExtensionSchemaUpdates hook |
| 94 | + */ |
| 95 | + private function loadExtensions() { |
| 96 | + if ( !defined( 'MEDIAWIKI_INSTALL' ) ) { |
| 97 | + return; // already loaded |
| 98 | + } |
| 99 | + $vars = Installer::getExistingLocalSettings(); |
| 100 | + if ( !$vars ) { |
| 101 | + return; // no LocalSettings found |
| 102 | + } |
| 103 | + if ( !isset( $vars['wgHooks'] ) && !isset( $vars['wgHooks']['LoadExtensionSchemaUpdates'] ) ) { |
| 104 | + return; |
| 105 | + } |
| 106 | + global $wgHooks, $wgAutoloadClasses; |
| 107 | + $wgHooks['LoadExtensionSchemaUpdates'] = $vars['wgHooks']['LoadExtensionSchemaUpdates']; |
| 108 | + $wgAutoloadClasses = $wgAutoloadClasses + $vars['wgAutoloadClasses']; |
| 109 | + } |
| 110 | + |
| 111 | + /** |
92 | 112 | * @throws MWException |
93 | 113 | * @param DatabaseBase $db |
94 | 114 | * @param bool $shared |
Index: branches/REL1_18/phase3/includes/installer/Installer.php |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | * |
458 | 458 | * @return Array |
459 | 459 | */ |
460 | | - public function getExistingLocalSettings() { |
| 460 | + public static function getExistingLocalSettings() { |
461 | 461 | global $IP; |
462 | 462 | |
463 | 463 | wfSuppressWarnings(); |
Index: branches/REL1_18/phase3/includes/installer/LocalSettingsGenerator.php |
— | — | @@ -183,6 +183,19 @@ |
184 | 184 | $metaNamespace = "\$wgMetaNamespace = \"{$this->values['wgMetaNamespace']}\";\n"; |
185 | 185 | } |
186 | 186 | |
| 187 | + $groupRights = ''; |
| 188 | + if( $this->groupPermissions ) { |
| 189 | + $groupRights .= "# The following permissions were set based on your choice in the installer\n"; |
| 190 | + foreach( $this->groupPermissions as $group => $rightArr ) { |
| 191 | + $group = self::escapePhpString( $group ); |
| 192 | + foreach( $rightArr as $right => $perm ) { |
| 193 | + $right = self::escapePhpString( $right ); |
| 194 | + $groupRights .= "\$wgGroupPermissions['$group']['$right'] = " . |
| 195 | + wfBoolToStr( $perm ) . ";\n"; |
| 196 | + } |
| 197 | + } |
| 198 | + } |
| 199 | + |
187 | 200 | switch( $this->values['wgMainCacheType'] ) { |
188 | 201 | case 'anything': |
189 | 202 | case 'db': |
Index: branches/REL1_18/phase3/includes/installer/CliInstaller.php |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | * Main entry point. |
90 | 90 | */ |
91 | 91 | public function execute() { |
92 | | - $vars = $this->getExistingLocalSettings(); |
| 92 | + $vars = Installer::getExistingLocalSettings(); |
93 | 93 | if( $vars ) { |
94 | 94 | $this->showStatusMessage( |
95 | 95 | Status::newFatal( "config-localsettings-cli-upgrade" ) |
Index: branches/REL1_18/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -225,7 +225,7 @@ |
226 | 226 | class WebInstaller_ExistingWiki extends WebInstallerPage { |
227 | 227 | public function execute() { |
228 | 228 | // If there is no LocalSettings.php, continue to the installer welcome page |
229 | | - $vars = $this->parent->getExistingLocalSettings(); |
| 229 | + $vars = Installer::getExistingLocalSettings(); |
230 | 230 | if ( !$vars ) { |
231 | 231 | return 'skip'; |
232 | 232 | } |
Index: branches/REL1_18/phase3/includes/api/ApiQuery.php |
— | — | @@ -478,10 +478,6 @@ |
479 | 479 | } |
480 | 480 | } |
481 | 481 | } |
482 | | - // only export when there are titles |
483 | | - if ( !count( $exportTitles ) ) { |
484 | | - return; |
485 | | - } |
486 | 482 | |
487 | 483 | $exporter = new WikiExporter( $this->getDB() ); |
488 | 484 | // WikiExporter writes to stdout, so catch its |
Index: branches/REL1_18/phase3/includes/api/ApiPageSet.php |
— | — | @@ -446,18 +446,24 @@ |
447 | 447 | } |
448 | 448 | |
449 | 449 | $pageids = array_map( 'intval', $pageids ); // paranoia |
450 | | - $set = array( |
451 | | - 'page_id' => $pageids |
452 | | - ); |
453 | | - $db = $this->getDB(); |
| 450 | + $remaining = array_flip( $pageids ); |
454 | 451 | |
455 | | - // Get pageIDs data from the `page` table |
456 | | - $this->profileDBIn(); |
457 | | - $res = $db->select( 'page', $this->getPageTableFields(), $set, |
458 | | - __METHOD__ ); |
459 | | - $this->profileDBOut(); |
| 452 | + $pageids = self::getPositiveIntegers( $pageids ); |
460 | 453 | |
461 | | - $remaining = array_flip( $pageids ); |
| 454 | + $res = null; |
| 455 | + if ( count( $pageids ) ) { |
| 456 | + $set = array( |
| 457 | + 'page_id' => $pageids |
| 458 | + ); |
| 459 | + $db = $this->getDB(); |
| 460 | + |
| 461 | + // Get pageIDs data from the `page` table |
| 462 | + $this->profileDBIn(); |
| 463 | + $res = $db->select( 'page', $this->getPageTableFields(), $set, |
| 464 | + __METHOD__ ); |
| 465 | + $this->profileDBOut(); |
| 466 | + } |
| 467 | + |
462 | 468 | $this->initFromQueryResult( $res, $remaining, false ); // process PageIDs |
463 | 469 | |
464 | 470 | // Resolve any found redirects |
— | — | @@ -479,20 +485,22 @@ |
480 | 486 | ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' ); |
481 | 487 | } |
482 | 488 | |
483 | | - foreach ( $res as $row ) { |
484 | | - $pageId = intval( $row->page_id ); |
| 489 | + if ( $res ) { |
| 490 | + foreach ( $res as $row ) { |
| 491 | + $pageId = intval( $row->page_id ); |
485 | 492 | |
486 | | - // Remove found page from the list of remaining items |
487 | | - if ( isset( $remaining ) ) { |
488 | | - if ( $processTitles ) { |
489 | | - unset( $remaining[$row->page_namespace][$row->page_title] ); |
490 | | - } else { |
491 | | - unset( $remaining[$pageId] ); |
| 493 | + // Remove found page from the list of remaining items |
| 494 | + if ( isset( $remaining ) ) { |
| 495 | + if ( $processTitles ) { |
| 496 | + unset( $remaining[$row->page_namespace][$row->page_title] ); |
| 497 | + } else { |
| 498 | + unset( $remaining[$pageId] ); |
| 499 | + } |
492 | 500 | } |
| 501 | + |
| 502 | + // Store any extra fields requested by modules |
| 503 | + $this->processDbRow( $row ); |
493 | 504 | } |
494 | | - |
495 | | - // Store any extra fields requested by modules |
496 | | - $this->processDbRow( $row ); |
497 | 505 | } |
498 | 506 | |
499 | 507 | if ( isset( $remaining ) ) { |
— | — | @@ -534,21 +542,25 @@ |
535 | 543 | $pageids = array(); |
536 | 544 | $remaining = array_flip( $revids ); |
537 | 545 | |
538 | | - $tables = array( 'revision', 'page' ); |
539 | | - $fields = array( 'rev_id', 'rev_page' ); |
540 | | - $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
| 546 | + $revids = self::getPositiveIntegers( $revids ); |
541 | 547 | |
542 | | - // Get pageIDs data from the `page` table |
543 | | - $this->profileDBIn(); |
544 | | - $res = $db->select( $tables, $fields, $where, __METHOD__ ); |
545 | | - foreach ( $res as $row ) { |
546 | | - $revid = intval( $row->rev_id ); |
547 | | - $pageid = intval( $row->rev_page ); |
548 | | - $this->mGoodRevIDs[$revid] = $pageid; |
549 | | - $pageids[$pageid] = ''; |
550 | | - unset( $remaining[$revid] ); |
| 548 | + if ( count( $revids ) ) { |
| 549 | + $tables = array( 'revision', 'page' ); |
| 550 | + $fields = array( 'rev_id', 'rev_page' ); |
| 551 | + $where = array( 'rev_id' => $revids, 'rev_page = page_id' ); |
| 552 | + |
| 553 | + // Get pageIDs data from the `page` table |
| 554 | + $this->profileDBIn(); |
| 555 | + $res = $db->select( $tables, $fields, $where, __METHOD__ ); |
| 556 | + foreach ( $res as $row ) { |
| 557 | + $revid = intval( $row->rev_id ); |
| 558 | + $pageid = intval( $row->rev_page ); |
| 559 | + $this->mGoodRevIDs[$revid] = $pageid; |
| 560 | + $pageids[$pageid] = ''; |
| 561 | + unset( $remaining[$revid] ); |
| 562 | + } |
| 563 | + $this->profileDBOut(); |
551 | 564 | } |
552 | | - $this->profileDBOut(); |
553 | 565 | |
554 | 566 | $this->mMissingRevIDs = array_keys( $remaining ); |
555 | 567 | |
— | — | @@ -710,6 +722,25 @@ |
711 | 723 | return $linkBatch; |
712 | 724 | } |
713 | 725 | |
| 726 | + /** |
| 727 | + * Returns the input array of integers with all values < 0 removed |
| 728 | + * |
| 729 | + * @param $array array |
| 730 | + * @return array |
| 731 | + */ |
| 732 | + private static function getPositiveIntegers( $array ) { |
| 733 | + // bug 25734 API: possible issue with revids validation |
| 734 | + // It seems with a load of revision rows, MySQL gets upset |
| 735 | + // Remove any < 0 integers, as they can't be valid |
| 736 | + foreach( $array as $i => $int ) { |
| 737 | + if ( $int < 0 ) { |
| 738 | + unset( $array[$i] ); |
| 739 | + } |
| 740 | + } |
| 741 | + |
| 742 | + return $array; |
| 743 | + } |
| 744 | + |
714 | 745 | protected function getAllowedParams() { |
715 | 746 | return array( |
716 | 747 | 'titles' => array( |
Index: branches/REL1_18/phase3/includes/specials/SpecialVersion.php |
— | — | @@ -109,7 +109,7 @@ |
110 | 110 | 'Aryeh Gregor', 'Aaron Schulz', 'Andrew Garrett', 'Raimond Spekking', |
111 | 111 | 'Alexandre Emsenhuber', 'Siebrand Mazeland', 'Chad Horohoe', |
112 | 112 | 'Roan Kattouw', 'Trevor Parscal', 'Bryan Tong Minh', 'Sam Reed', |
113 | | - 'Victor Vasiliev', 'Rotem Liss', 'Platonides', |
| 113 | + 'Victor Vasiliev', 'Rotem Liss', 'Platonides', 'Ashar Voultoiz', |
114 | 114 | wfMsg( 'version-poweredby-others' ) |
115 | 115 | ); |
116 | 116 | |
Index: branches/REL1_18/phase3/resources/Resources.php |
— | — | @@ -135,6 +135,7 @@ |
136 | 136 | 'jquery.suggestions' => array( |
137 | 137 | 'scripts' => 'resources/jquery/jquery.suggestions.js', |
138 | 138 | 'styles' => 'resources/jquery/jquery.suggestions.css', |
| 139 | + 'dependencies' => 'jquery.autoEllipsis', |
139 | 140 | ), |
140 | 141 | 'jquery.tabIndex' => array( |
141 | 142 | 'scripts' => 'resources/jquery/jquery.tabIndex.js', |