Index: trunk/phase3/maintenance/fetchText.php |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | $this->mDescription = "Fetch the revision text from an old_id"; |
31 | 31 | } |
32 | 32 | |
33 | | - /* |
| 33 | + /** |
34 | 34 | * returns a string containing the following in order: |
35 | 35 | * textid |
36 | 36 | * \n |
Index: trunk/phase3/skins/common/upload.js |
— | — | @@ -34,46 +34,45 @@ |
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
38 | | - |
39 | | - |
| 38 | + |
40 | 39 | // AJAX wpDestFile warnings |
41 | 40 | if ( wgAjaxUploadDestCheck ) { |
42 | 41 | // Insert an event handler that fetches upload warnings when wpDestFile |
43 | 42 | // has been changed |
44 | | - document.getElementById( 'wpDestFile' ).onchange = function ( e ) { |
| 43 | + document.getElementById( 'wpDestFile' ).onchange = function ( e ) { |
45 | 44 | wgUploadWarningObj.checkNow(this.value); |
46 | 45 | }; |
47 | | - // Insert a row where the warnings will be displayed just below the |
| 46 | + // Insert a row where the warnings will be displayed just below the |
48 | 47 | // wpDestFile row |
49 | 48 | var optionsTable = document.getElementById( 'mw-htmlform-description' ).tBodies[0]; |
50 | 49 | var row = optionsTable.insertRow( 1 ); |
51 | 50 | var td = document.createElement( 'td' ); |
52 | 51 | td.id = 'wpDestFile-warning'; |
53 | 52 | td.colSpan = 2; |
54 | | - |
| 53 | + |
55 | 54 | row.appendChild( td ); |
56 | 55 | } |
57 | | - |
| 56 | + |
58 | 57 | var wpLicense = document.getElementById( 'wpLicense' ); |
59 | 58 | if ( wgAjaxLicensePreview && wpLicense ) { |
60 | 59 | // License selector check |
61 | 60 | wpLicense.onchange = licenseSelectorCheck; |
62 | | - |
| 61 | + |
63 | 62 | // License selector table row |
64 | 63 | var wpLicenseRow = wpLicense.parentNode.parentNode; |
65 | 64 | var wpLicenseTbody = wpLicenseRow.parentNode; |
66 | | - |
| 65 | + |
67 | 66 | var row = document.createElement( 'tr' ); |
68 | 67 | var td = document.createElement( 'td' ); |
69 | 68 | row.appendChild( td ); |
70 | 69 | td = document.createElement( 'td' ); |
71 | 70 | td.id = 'mw-license-preview'; |
72 | 71 | row.appendChild( td ); |
73 | | - |
| 72 | + |
74 | 73 | wpLicenseTbody.insertBefore( row, wpLicenseRow.nextSibling ); |
75 | 74 | } |
76 | | - |
77 | | - |
| 75 | + |
| 76 | + |
78 | 77 | // fillDestFile setup |
79 | 78 | for ( var i = 0; i < wgUploadSourceIds.length; i++ ) |
80 | 79 | document.getElementById( wgUploadSourceIds[i] ).onchange = function (e) { |
— | — | @@ -150,7 +149,7 @@ |
151 | 150 | var ackElt = document.getElementsByName( 'wpDestFileWarningAck' ); |
152 | 151 | |
153 | 152 | this.setInnerHTML(warningElt, warning); |
154 | | - |
| 153 | + |
155 | 154 | // Set a value in the form indicating that the warning is acknowledged and |
156 | 155 | // doesn't need to be redisplayed post-upload |
157 | 156 | if ( warning == '' || warning == ' ' ) { |
— | — | @@ -196,7 +195,7 @@ |
197 | 196 | } |
198 | 197 | |
199 | 198 | // Clear the filename if it does not have a valid extension. |
200 | | - // URLs are less likely to have a useful extension, so don't include them in the |
| 199 | + // URLs are less likely to have a useful extension, so don't include them in the |
201 | 200 | // extension check. |
202 | 201 | if( wgStrictFileExtensions && wgFileExtensions && id != 'wpUploadFileURL' ) { |
203 | 202 | var found = false; |
— | — | @@ -262,15 +261,15 @@ |
263 | 262 | } |
264 | 263 | } |
265 | 264 | injectSpinner( document.getElementById( 'wpLicense' ), 'license' ); |
266 | | - |
| 265 | + |
267 | 266 | var title = document.getElementById('wpDestFile').value; |
268 | 267 | if ( !title ) title = 'File:Sample.jpg'; |
269 | | - |
| 268 | + |
270 | 269 | var url = wgScriptPath + '/api' + wgScriptExtension |
271 | 270 | + '?action=parse&text={{' + encodeURIComponent( license ) + '}}' |
272 | | - + '&title=' + encodeURIComponent( title ) |
| 271 | + + '&title=' + encodeURIComponent( title ) |
273 | 272 | + '&prop=text&pst&format=json'; |
274 | | - |
| 273 | + |
275 | 274 | var req = sajax_init_object(); |
276 | 275 | req.onreadystatechange = function() { |
277 | 276 | if ( req.readyState == 4 && req.status == 200 ) |
— | — | @@ -284,7 +283,6 @@ |
285 | 284 | removeSpinner( 'license' ); |
286 | 285 | this.responseCache[license] = result['parse']['text']['*']; |
287 | 286 | this.showPreview( this.responseCache[license] ); |
288 | | - |
289 | 287 | }, |
290 | 288 | |
291 | 289 | 'showPreview' : function( preview ) { |
Index: trunk/phase3/tests/selenium/suites/MediawikiCoreSmokeTestCase.php |
— | — | @@ -1,44 +1,44 @@ |
2 | 2 | <?php |
3 | | -/* |
| 3 | +/* |
4 | 4 | * Stub of tests be need as part of the hack-a-ton |
5 | 5 | */ |
6 | 6 | class MediawikiCoreSmokeTestCase extends SeleniumTestCase { |
7 | 7 | public function testUserLogin() { |
8 | | - |
| 8 | + |
9 | 9 | } |
10 | | - |
| 10 | + |
11 | 11 | public function testChangeUserPreference() { |
12 | | - |
| 12 | + |
13 | 13 | } |
14 | | - |
15 | | - /* |
| 14 | + |
| 15 | + /** |
16 | 16 | * TODO: generalize this test to be reusable for different skins |
17 | 17 | */ |
18 | 18 | public function testCreateNewPageVector() { |
19 | | - |
| 19 | + |
20 | 20 | } |
21 | | - |
22 | | - /* |
| 21 | + |
| 22 | + /** |
23 | 23 | * TODO: generalize this test to be reusable for different skins |
24 | 24 | */ |
25 | 25 | public function testEditExistingPageVector() { |
26 | | - |
| 26 | + |
27 | 27 | } |
28 | | - |
29 | | - /* |
| 28 | + |
| 29 | + /** |
30 | 30 | * TODO: generalize this test to be reusable for different skins |
31 | 31 | */ |
32 | 32 | public function testCreateNewPageMonobook() { |
33 | | - |
| 33 | + |
34 | 34 | } |
35 | | - |
36 | | - /* |
| 35 | + |
| 36 | + /** |
37 | 37 | * TODO: generalize this test to be reusable for different skins |
38 | 38 | */ |
39 | 39 | public function testEditExistingPageMonobook() { |
40 | | - |
| 40 | + |
41 | 41 | } |
42 | | - |
| 42 | + |
43 | 43 | public function testImageUpload() { |
44 | 44 | $this->login(); |
45 | 45 | $this->open( $this->getUrl() . |
— | — | @@ -48,10 +48,10 @@ |
49 | 49 | $this->check( 'wpIgnoreWarning' ); |
50 | 50 | $this->click( 'wpUpload' ); |
51 | 51 | $this->waitForPageToLoad( 30000 ); |
52 | | - |
| 52 | + |
53 | 53 | $this->assertSeleniumHTMLContains( |
54 | 54 | '//h1[@class="firstHeading"]', "Wikipedia-logo-v2-de.png" ); |
55 | | - |
| 55 | + |
56 | 56 | /* |
57 | 57 | $this->open( $this->getUrl() . '/index.php?title=Image:' |
58 | 58 | . ucfirst( $this->filename ) . '&action=delete' ); |
— | — | @@ -64,6 +64,6 @@ |
65 | 65 | ucfirst( $this->filename ) . '.*has been deleted.' ); |
66 | 66 | */ |
67 | 67 | } |
68 | | - |
69 | 68 | |
| 69 | + |
70 | 70 | } |
Index: trunk/phase3/tests/selenium/suites/SimpleSeleniumTestCase.php |
— | — | @@ -1,11 +1,11 @@ |
2 | 2 | <?php |
3 | | -/* |
| 3 | +/* |
4 | 4 | * This test case is part of the SimpleSeleniumTestSuite. |
5 | 5 | * Configuration for these tests are documented as part of SimpleSeleniumTestSuite.php |
6 | 6 | */ |
7 | 7 | class SimpleSeleniumTestCase extends SeleniumTestCase { |
8 | 8 | public function testBasic() { |
9 | | - $this->open( $this->getUrl() . |
| 9 | + $this->open( $this->getUrl() . |
10 | 10 | '/index.php?title=Selenium&action=edit' ); |
11 | 11 | $this->type( "wpTextbox1", "This is a basic test" ); |
12 | 12 | $this->click( "wpPreview" ); |
— | — | @@ -16,8 +16,8 @@ |
17 | 17 | $correct = strstr( $source, "This is a basic test" ); |
18 | 18 | $this->assertEquals( $correct, true ); |
19 | 19 | } |
20 | | - |
21 | | - /* |
| 20 | + |
| 21 | + /** |
22 | 22 | * All this test really does is verify that a global var was set. |
23 | 23 | * It depends on $wgDefaultSkin = 'chick'; being set |
24 | 24 | */ |
— | — | @@ -26,9 +26,9 @@ |
27 | 27 | $bodyClass = $this->getAttribute( "//body/@class" ); |
28 | 28 | $this-> assertContains('skin-chick', $bodyClass, 'Chick skin not set'); |
29 | 29 | } |
30 | | - |
31 | | - /* |
32 | | - * Just verify that the test db was loaded correctly |
| 30 | + |
| 31 | + /** |
| 32 | + * Just verify that the test db was loaded correctly |
33 | 33 | */ |
34 | 34 | public function testDatabaseResourceLoadedCorrectly() { |
35 | 35 | $this->open( $this->getUrl() . '/index.php/TestResources?action=purge' ); |
Index: trunk/phase3/tests/selenium/SeleniumConfig.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | |
7 | 7 | class SeleniumConfig { |
8 | 8 | |
9 | | - /* |
| 9 | + /** |
10 | 10 | * Retreives the Selenium configuration values from an ini file. |
11 | 11 | * See sample config file in selenium_settings.ini.sample |
12 | 12 | * |
— | — | @@ -72,14 +72,14 @@ |
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | $header = ''; |
76 | | - |
| 76 | + |
77 | 77 | $configArray = array(); |
78 | | - |
| 78 | + |
79 | 79 | while ( ( $line = fgets( $file ) ) !== false ) { |
80 | 80 | $line = strtok( $line, "\r\n" ); |
81 | | - |
| 81 | + |
82 | 82 | if ( !$line || $line[0] == ';' ) continue; |
83 | | - |
| 83 | + |
84 | 84 | if ( $line[0] == '[' && substr( $line, -1 ) == ']' ) { |
85 | 85 | $header = substr( $line, 1, -1 ); |
86 | 86 | $configArray[$header] = array(); |
— | — | @@ -95,19 +95,19 @@ |
96 | 96 | list( $key, $value ) = explode( '=', $iniLine, 2 ); |
97 | 97 | $key = trim( $key ); |
98 | 98 | $value = trim( $value ); |
99 | | - |
| 99 | + |
100 | 100 | if ( isset( $specialValues[$value] ) ) { |
101 | 101 | $value = $specialValues[$value]; |
102 | 102 | } else { |
103 | 103 | $value = trim( $value, '"' ); |
104 | 104 | } |
105 | | - |
| 105 | + |
106 | 106 | /* Support one-level arrays */ |
107 | 107 | if ( preg_match( '/^([A-Za-z]+)\[([A-Za-z]+)\]/', $key, $m ) ) { |
108 | 108 | $key = $m[1]; |
109 | 109 | $value = array( $m[2] => $value ); |
110 | 110 | } |
111 | | - |
| 111 | + |
112 | 112 | return array( $key => $value ); |
113 | 113 | } |
114 | 114 | } |
Index: trunk/phase3/tests/phpunit/includes/search/SearchEngineTest.php |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | unset( $this->search ); |
14 | 14 | } |
15 | 15 | |
16 | | - /* |
| 16 | + /** |
17 | 17 | * Checks for database type & version. |
18 | 18 | * Will skip current test if DB does not support search. |
19 | 19 | */ |
Index: trunk/phase3/tests/phpunit/includes/parser/NewParserTest.php |
— | — | @@ -729,7 +729,7 @@ |
730 | 730 | } |
731 | 731 | //Various "cleanup" functions |
732 | 732 | |
733 | | - /* |
| 733 | + /** |
734 | 734 | * Run the "tidy" command on text if the $wgUseTidy |
735 | 735 | * global is true |
736 | 736 | * |
Index: trunk/phase3/tests/phpunit/includes/IPTest.php |
— | — | @@ -43,20 +43,20 @@ |
44 | 44 | $this->assertFalse( IP::isIPv6( 'fc:100:::' ), 'IPv6 ending with a ":::"' ); |
45 | 45 | $this->assertFalse( IP::isIPv6( 'fc:300' ), 'IPv6 with only 2 words' ); |
46 | 46 | $this->assertFalse( IP::isIPv6( 'fc:100:300' ), 'IPv6 with only 3 words' ); |
47 | | - |
| 47 | + |
48 | 48 | $this->assertTrue( IP::isIPv6( 'fc:100::' ) ); |
49 | 49 | $this->assertTrue( IP::isIPv6( 'fc:100:a::' ) ); |
50 | 50 | $this->assertTrue( IP::isIPv6( 'fc:100:a:d::' ) ); |
51 | 51 | $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1::' ) ); |
52 | 52 | $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e::' ) ); |
53 | 53 | $this->assertTrue( IP::isIPv6( 'fc:100:a:d:1:e:ac::' ) ); |
54 | | - |
| 54 | + |
55 | 55 | $this->assertFalse( IP::isIPv6( 'fc:100:a:d:1:e:ac:0::' ), 'IPv6 with 8 words ending with "::"' ); |
56 | 56 | $this->assertFalse( IP::isIPv6( 'fc:100:a:d:1:e:ac:0:1::' ), 'IPv6 with 9 words ending with "::"' ); |
57 | 57 | |
58 | 58 | $this->assertFalse( IP::isIPv6( ':::' ) ); |
59 | 59 | $this->assertFalse( IP::isIPv6( '::0:' ), 'IPv6 ending in a lone ":"' ); |
60 | | - |
| 60 | + |
61 | 61 | $this->assertTrue( IP::isIPv6( '::' ), 'IPv6 zero address' ); |
62 | 62 | $this->assertTrue( IP::isIPv6( '::0' ) ); |
63 | 63 | $this->assertTrue( IP::isIPv6( '::fc' ) ); |
— | — | @@ -66,14 +66,14 @@ |
67 | 67 | $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1' ) ); |
68 | 68 | $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1:e' ) ); |
69 | 69 | $this->assertTrue( IP::isIPv6( '::fc:100:a:d:1:e:ac' ) ); |
70 | | - |
| 70 | + |
71 | 71 | $this->assertFalse( IP::isIPv6( '::fc:100:a:d:1:e:ac:0' ), 'IPv6 with "::" and 8 words' ); |
72 | 72 | $this->assertFalse( IP::isIPv6( '::fc:100:a:d:1:e:ac:0:1' ), 'IPv6 with 9 words' ); |
73 | 73 | |
74 | 74 | $this->assertFalse( IP::isIPv6( ':fc::100' ), 'IPv6 starting with lone ":"' ); |
75 | 75 | $this->assertFalse( IP::isIPv6( 'fc::100:' ), 'IPv6 ending with lone ":"' ); |
76 | 76 | $this->assertFalse( IP::isIPv6( 'fc:::100' ), 'IPv6 with ":::" in the middle' ); |
77 | | - |
| 77 | + |
78 | 78 | $this->assertTrue( IP::isIPv6( 'fc::100' ), 'IPv6 with "::" and 2 words' ); |
79 | 79 | $this->assertTrue( IP::isIPv6( 'fc::100:a' ), 'IPv6 with "::" and 3 words' ); |
80 | 80 | $this->assertTrue( IP::isIPv6( 'fc::100:a:d', 'IPv6 with "::" and 4 words' ) ); |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | $this->assertTrue( IP::isIPv6( '2001::df'), 'IPv6 with "::" and 2 words' ); |
85 | 85 | $this->assertTrue( IP::isIPv6( '2001:5c0:1400:a::df'), 'IPv6 with "::" and 5 words' ); |
86 | 86 | $this->assertTrue( IP::isIPv6( '2001:5c0:1400:a::df:2'), 'IPv6 with "::" and 6 words' ); |
87 | | - |
| 87 | + |
88 | 88 | $this->assertFalse( IP::isIPv6( 'fc::100:a:d:1:e:ac:0' ), 'IPv6 with "::" and 8 words' ); |
89 | 89 | $this->assertFalse( IP::isIPv6( 'fc::100:a:d:1:e:ac:0:1' ), 'IPv6 with 9 words' ); |
90 | 90 | |
— | — | @@ -135,11 +135,11 @@ |
136 | 136 | $this->assertFalse( IP::isValid( 'fc:100:::' ), 'IPv6 ending with a ":::"' ); |
137 | 137 | $this->assertFalse( IP::isValid( 'fc:300' ), 'IPv6 with only 2 words' ); |
138 | 138 | $this->assertFalse( IP::isValid( 'fc:100:300' ), 'IPv6 with only 3 words' ); |
139 | | - |
| 139 | + |
140 | 140 | $this->assertTrue( IP::isValid( 'fc:100::' ) ); |
141 | 141 | $this->assertTrue( IP::isValid( 'fc:100:a:d:1:e::' ) ); |
142 | 142 | $this->assertTrue( IP::isValid( 'fc:100:a:d:1:e:ac::' ) ); |
143 | | - |
| 143 | + |
144 | 144 | $this->assertTrue( IP::isValid( 'fc::100' ), 'IPv6 with "::" and 2 words' ); |
145 | 145 | $this->assertTrue( IP::isValid( 'fc::100:a' ), 'IPv6 with "::" and 3 words' ); |
146 | 146 | $this->assertTrue( IP::isValid( '2001::df'), 'IPv6 with "::" and 2 words' ); |
— | — | @@ -147,7 +147,7 @@ |
148 | 148 | $this->assertTrue( IP::isValid( '2001:5c0:1400:a::df:2'), 'IPv6 with "::" and 6 words' ); |
149 | 149 | $this->assertTrue( IP::isValid( 'fc::100:a:d:1' ), 'IPv6 with "::" and 5 words' ); |
150 | 150 | $this->assertTrue( IP::isValid( 'fc::100:a:d:1:e:ac' ), 'IPv6 with "::" and 7 words' ); |
151 | | - |
| 151 | + |
152 | 152 | $this->assertFalse( IP::isValid( 'fc:100:a:d:1:e:ac:0::' ), 'IPv6 with 8 words ending with "::"' ); |
153 | 153 | $this->assertFalse( IP::isValid( 'fc:100:a:d:1:e:ac:0:1::' ), 'IPv6 with 9 words ending with "::"' ); |
154 | 154 | } |
— | — | @@ -332,7 +332,7 @@ |
333 | 333 | $this->assertEquals( '0:0:0:0:0:0:FCCF:FAFF', IP::hexToOctet( 'FCCFFAFF' ) ); |
334 | 334 | } |
335 | 335 | |
336 | | - /* |
| 336 | + /** |
337 | 337 | * IP::parseCIDR() returns an array containing a signed IP address |
338 | 338 | * representing the network mask and the bit mask. |
339 | 339 | * @covers IP::parseCIDR |
— | — | @@ -391,7 +391,7 @@ |
392 | 392 | } |
393 | 393 | |
394 | 394 | /** |
395 | | - * Issues there are most probably from IP::toHex() or IP::parseRange() |
| 395 | + * Issues there are most probably from IP::toHex() or IP::parseRange() |
396 | 396 | * @covers IP::isInRange |
397 | 397 | * @dataProvider provideIPsAndRanges |
398 | 398 | */ |
— | — | @@ -464,9 +464,9 @@ |
465 | 465 | */ |
466 | 466 | function testCombineHostAndPort( $expected, $input, $description ) { |
467 | 467 | list( $host, $port, $defaultPort ) = $input; |
468 | | - $this->assertEquals( |
469 | | - $expected, |
470 | | - IP::combineHostAndPort( $host, $port, $defaultPort ), |
| 468 | + $this->assertEquals( |
| 469 | + $expected, |
| 470 | + IP::combineHostAndPort( $host, $port, $defaultPort ), |
471 | 471 | $description ); |
472 | 472 | } |
473 | 473 | |
Index: trunk/phase3/tests/phpunit/includes/SeleniumConfigurationTest.php |
— | — | @@ -2,13 +2,13 @@ |
3 | 3 | |
4 | 4 | class SeleniumConfigurationTest extends MediaWikiTestCase { |
5 | 5 | |
6 | | - /* |
| 6 | + /** |
7 | 7 | * The file where the test temporarity stores the selenium config. |
8 | 8 | * This should be cleaned up as part of teardown. |
9 | 9 | */ |
10 | 10 | private $tempFileName; |
11 | 11 | |
12 | | - /* |
| 12 | + /** |
13 | 13 | * String containing the a sample selenium settings |
14 | 14 | */ |
15 | 15 | private $testConfig0 = |
— | — | @@ -32,14 +32,14 @@ |
33 | 33 | testSuite[SimpleSeleniumTestSuite] = "tests/selenium/SimpleSeleniumTestSuite.php" |
34 | 34 | testSuite[TestSuiteName] = "testSuitePath" |
35 | 35 | '; |
36 | | - /* |
| 36 | + /** |
37 | 37 | * Array of expected browsers from $testConfig0 |
38 | 38 | */ |
39 | 39 | private $testBrowsers0 = array( 'firefox' => '*firefox', |
40 | 40 | 'iexplorer' => '*iexploreproxy', |
41 | 41 | 'chrome' => '*chrome' |
42 | 42 | ); |
43 | | - /* |
| 43 | + /** |
44 | 44 | * Array of expected selenium settings from $testConfig0 |
45 | 45 | */ |
46 | 46 | private $testSettings0 = array( |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | 'jUnitLogFile' => null, |
57 | 57 | 'runAgainstGrid' => null |
58 | 58 | ); |
59 | | - /* |
| 59 | + /** |
60 | 60 | * Array of expected testSuites from $testConfig0 |
61 | 61 | */ |
62 | 62 | private $testSuites0 = array( |
— | — | @@ -64,7 +64,7 @@ |
65 | 65 | ); |
66 | 66 | |
67 | 67 | |
68 | | - /* |
| 68 | + /** |
69 | 69 | * Another sample selenium settings file contents |
70 | 70 | */ |
71 | 71 | private $testConfig1 = |
— | — | @@ -73,11 +73,11 @@ |
74 | 74 | host = "localhost" |
75 | 75 | testBrowser = "firefox" |
76 | 76 | '; |
77 | | - /* |
| 77 | + /** |
78 | 78 | * Expected browsers from $testConfig1 |
79 | 79 | */ |
80 | 80 | private $testBrowsers1 = null; |
81 | | - /* |
| 81 | + /** |
82 | 82 | * Expected selenium settings from $testConfig1 |
83 | 83 | */ |
84 | 84 | private $testSettings1 = array( |
— | — | @@ -93,7 +93,7 @@ |
94 | 94 | 'jUnitLogFile' => null, |
95 | 95 | 'runAgainstGrid' => null |
96 | 96 | ); |
97 | | - /* |
| 97 | + /** |
98 | 98 | * Expected test suites from $testConfig1 |
99 | 99 | */ |
100 | 100 | private $testSuites1 = null; |
— | — | @@ -105,7 +105,7 @@ |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | | - /* |
| 109 | + /** |
110 | 110 | * Clean up the temporary file used to store the selenium settings. |
111 | 111 | */ |
112 | 112 | public function tearDown() { |
— | — | @@ -199,7 +199,7 @@ |
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | | - /* |
| 203 | + /** |
204 | 204 | * create a temp file and write text to it. |
205 | 205 | * @param $testToWrite the text to write to the temp file |
206 | 206 | */ |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | fclose($tempFile); |
212 | 212 | } |
213 | 213 | |
214 | | - /* |
| 214 | + /** |
215 | 215 | * Returns an array containing: |
216 | 216 | * The contents of the selenium cingiguration ini file |
217 | 217 | * The expected selenium configuration array that getSeleniumSettings should return |
Index: trunk/phase3/tests/parser/parserTest.inc |
— | — | @@ -1199,7 +1199,7 @@ |
1200 | 1200 | return true; |
1201 | 1201 | } |
1202 | 1202 | |
1203 | | - /* |
| 1203 | + /** |
1204 | 1204 | * Run the "tidy" command on text if the $wgUseTidy |
1205 | 1205 | * global is true |
1206 | 1206 | * |
Index: trunk/phase3/includes/WikiFilePage.php |
— | — | @@ -25,13 +25,15 @@ |
26 | 26 | |
27 | 27 | /** |
28 | 28 | * @param $file File: |
29 | | - * @return void |
30 | 29 | */ |
31 | 30 | public function setFile( $file ) { |
32 | 31 | $this->mFile = $file; |
33 | 32 | $this->mFileLoaded = true; |
34 | 33 | } |
35 | 34 | |
| 35 | + /** |
| 36 | + * @return bool |
| 37 | + */ |
36 | 38 | protected function loadFile() { |
37 | 39 | if ( $this->mFileLoaded ) { |
38 | 40 | return true; |
— | — | @@ -49,6 +51,9 @@ |
50 | 52 | return true; |
51 | 53 | } |
52 | 54 | |
| 55 | + /** |
| 56 | + * @return mixed|null|Title |
| 57 | + */ |
53 | 58 | public function getRedirectTarget() { |
54 | 59 | $this->loadFile(); |
55 | 60 | if ( $this->mFile->isLocal() ) { |
— | — | @@ -63,6 +68,9 @@ |
64 | 69 | return $this->mRedirectTarget = Title::makeTitle( NS_FILE, $to ); |
65 | 70 | } |
66 | 71 | |
| 72 | + /** |
| 73 | + * @return bool|mixed|Title |
| 74 | + */ |
67 | 75 | public function followRedirect() { |
68 | 76 | $this->loadFile(); |
69 | 77 | if ( $this->mFile->isLocal() ) { |
— | — | @@ -76,6 +84,10 @@ |
77 | 85 | return Title::makeTitle( NS_FILE, $to ); |
78 | 86 | } |
79 | 87 | |
| 88 | + /** |
| 89 | + * @param bool $text |
| 90 | + * @return bool |
| 91 | + */ |
80 | 92 | public function isRedirect( $text = false ) { |
81 | 93 | $this->loadFile(); |
82 | 94 | if ( $this->mFile->isLocal() ) { |
— | — | @@ -85,16 +97,25 @@ |
86 | 98 | return (bool)$this->mFile->getRedirected(); |
87 | 99 | } |
88 | 100 | |
| 101 | + /** |
| 102 | + * @return bool |
| 103 | + */ |
89 | 104 | public function isLocal() { |
90 | 105 | $this->loadFile(); |
91 | 106 | return $this->mFile->isLocal(); |
92 | 107 | } |
93 | 108 | |
| 109 | + /** |
| 110 | + * @return bool|File |
| 111 | + */ |
94 | 112 | public function getFile() { |
95 | 113 | $this->loadFile(); |
96 | 114 | return $this->mFile; |
97 | 115 | } |
98 | 116 | |
| 117 | + /** |
| 118 | + * @return array|null |
| 119 | + */ |
99 | 120 | public function getDuplicates() { |
100 | 121 | $this->loadFile(); |
101 | 122 | if ( !is_null( $this->mDupes ) ) { |
— | — | @@ -108,6 +129,10 @@ |
109 | 130 | // Remove duplicates with self and non matching file sizes |
110 | 131 | $self = $this->mFile->getRepoName() . ':' . $this->mFile->getName(); |
111 | 132 | $size = $this->mFile->getSize(); |
| 133 | + |
| 134 | + /** |
| 135 | + * @var $file File |
| 136 | + */ |
112 | 137 | foreach ( $dupes as $index => $file ) { |
113 | 138 | $key = $file->getRepoName() . ':' . $file->getName(); |
114 | 139 | if ( $key == $self ) { |
Index: trunk/phase3/includes/ZhClient.php |
— | — | @@ -41,10 +41,7 @@ |
42 | 42 | $errno = $errstr = ''; |
43 | 43 | $this->mFP = fsockopen( $this->mHost, $this->mPort, $errno, $errstr, 30 ); |
44 | 44 | wfRestoreWarnings(); |
45 | | - if ( !$this->mFP ) { |
46 | | - return false; |
47 | | - } |
48 | | - return true; |
| 45 | + return !$this->mFP; |
49 | 46 | } |
50 | 47 | |
51 | 48 | /** |
— | — | @@ -77,10 +74,7 @@ |
78 | 75 | $data .= $str; |
79 | 76 | } |
80 | 77 | // data should be of length $len. otherwise something is wrong |
81 | | - if ( strlen( $data ) != $len ) { |
82 | | - return false; |
83 | | - } |
84 | | - return $data; |
| 78 | + return strlen( $data ) == $len; |
85 | 79 | } |
86 | 80 | |
87 | 81 | /** |
— | — | @@ -124,6 +118,7 @@ |
125 | 119 | } |
126 | 120 | return $ret; |
127 | 121 | } |
| 122 | + |
128 | 123 | /** |
129 | 124 | * Perform word segmentation |
130 | 125 | * |
Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -1192,6 +1192,10 @@ |
1193 | 1193 | $this->session = $session; |
1194 | 1194 | } |
1195 | 1195 | |
| 1196 | + /** |
| 1197 | + * @param $method string |
| 1198 | + * @throws MWException |
| 1199 | + */ |
1196 | 1200 | private function notImplemented( $method ) { |
1197 | 1201 | throw new MWException( "{$method}() not implemented" ); |
1198 | 1202 | } |
Index: trunk/phase3/includes/WikiMap.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | array( 'lang' => $minor, 'site' => $major ) ); |
30 | 30 | return new WikiReference( $major, $minor, $canonicalServer, $path, $server ); |
31 | 31 | } |
32 | | - |
| 32 | + |
33 | 33 | /** |
34 | 34 | * Convenience to get the wiki's display name |
35 | 35 | * |
— | — | @@ -87,11 +87,11 @@ |
88 | 88 | */ |
89 | 89 | public static function getForeignURL( $wikiID, $page ) { |
90 | 90 | $wiki = WikiMap::getWiki( $wikiID ); |
91 | | - |
| 91 | + |
92 | 92 | if ( $wiki ) { |
93 | 93 | return $wiki->getUrl( $page ); |
94 | 94 | } |
95 | | - |
| 95 | + |
96 | 96 | return false; |
97 | 97 | } |
98 | 98 | } |
— | — | @@ -114,6 +114,10 @@ |
115 | 115 | $this->mServer = $server === null ? $canonicalServer : $server; |
116 | 116 | } |
117 | 117 | |
| 118 | + /** |
| 119 | + * @return string |
| 120 | + * @throws MWException |
| 121 | + */ |
118 | 122 | public function getHostname() { |
119 | 123 | $prefixes = array( 'http://', 'https://' ); |
120 | 124 | foreach ( $prefixes as $prefix ) { |
— | — | @@ -159,22 +163,21 @@ |
160 | 164 | * @return String: Url |
161 | 165 | */ |
162 | 166 | public function getCanonicalUrl( $page ) { |
163 | | - return |
164 | | - $this->mCanonicalServer . |
165 | | - $this->getLocalUrl( $page ); |
| 167 | + return $this->mCanonicalServer . $this->getLocalUrl( $page ); |
166 | 168 | } |
167 | | - |
| 169 | + |
168 | 170 | /** |
169 | 171 | * Alias for getCanonicalUrl(), for backwards compatibility. |
| 172 | + * @return String |
170 | 173 | */ |
171 | 174 | public function getUrl( $page ) { |
172 | 175 | return $this->getCanonicalUrl( $page ); |
173 | 176 | } |
174 | | - |
| 177 | + |
175 | 178 | /** |
176 | 179 | * Get a URL based on $wgServer, like Title::getFullUrl() would produce |
177 | 180 | * when called locally on the wiki. |
178 | | - * |
| 181 | + * |
179 | 182 | * @param $page String: page name (must be normalized before calling this function!) |
180 | 183 | * @return String: URL |
181 | 184 | */ |
Index: trunk/phase3/includes/WikiPage.php |
— | — | @@ -26,8 +26,17 @@ |
27 | 27 | public $mIsRedirect = false; // !< Boolean |
28 | 28 | public $mLatest = false; // !< Boolean |
29 | 29 | public $mPreparedEdit = false; // !< Array |
30 | | - public $mRedirectTarget = null; // !< Title object |
31 | | - public $mLastRevision = null; // !< Revision object |
| 30 | + |
| 31 | + /** |
| 32 | + * @var Title |
| 33 | + */ |
| 34 | + public $mRedirectTarget = null; |
| 35 | + |
| 36 | + /** |
| 37 | + * @var Revision |
| 38 | + */ |
| 39 | + public $mLastRevision = null; |
| 40 | + |
32 | 41 | public $mTimestamp = ''; // !< String |
33 | 42 | public $mTouched = '19700101000000'; // !< String |
34 | 43 | /**@}}*/ |
— | — | @@ -700,6 +709,7 @@ |
701 | 710 | * Should the parser cache be used? |
702 | 711 | * |
703 | 712 | * @param $user User The relevant user |
| 713 | + * @param $oldid int |
704 | 714 | * @return boolean |
705 | 715 | */ |
706 | 716 | public function isParserCacheUsed( User $user, $oldid ) { |
— | — | @@ -756,7 +766,6 @@ |
757 | 767 | * |
758 | 768 | * @param $dbw DatabaseBase |
759 | 769 | * @return int The newly created page_id key, or false if the title already existed |
760 | | - * @private |
761 | 770 | */ |
762 | 771 | public function insertOn( $dbw ) { |
763 | 772 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1585,7 +1594,7 @@ |
1586 | 1595 | * Deletes the article with database consistency, writes logs, purges caches |
1587 | 1596 | * |
1588 | 1597 | * @param $reason string delete reason for deletion log |
1589 | | - * @param suppress bitfield |
| 1598 | + * @param $suppress bitfield |
1590 | 1599 | * Revision::DELETED_TEXT |
1591 | 1600 | * Revision::DELETED_COMMENT |
1592 | 1601 | * Revision::DELETED_USER |
— | — | @@ -2585,7 +2594,7 @@ |
2586 | 2595 | * Updates cascading protections |
2587 | 2596 | * |
2588 | 2597 | * @param $parserOutput ParserOutput object for the current version |
2589 | | - **/ |
| 2598 | + */ |
2590 | 2599 | public function doCascadeProtectionUpdates( ParserOutput $parserOutput ) { |
2591 | 2600 | if ( wfReadOnly() || !$this->mTitle->areRestrictionsCascading() ) { |
2592 | 2601 | return; |
— | — | @@ -2632,25 +2641,25 @@ |
2633 | 2642 | } |
2634 | 2643 | } |
2635 | 2644 | |
2636 | | - /* |
2637 | | - * @deprecated since 1.18 |
2638 | | - */ |
| 2645 | + /** |
| 2646 | + * @deprecated since 1.18 |
| 2647 | + */ |
2639 | 2648 | public function quickEdit( $text, $comment = '', $minor = 0 ) { |
2640 | 2649 | global $wgUser; |
2641 | 2650 | return $this->doQuickEdit( $text, $wgUser, $comment, $minor ); |
2642 | 2651 | } |
2643 | 2652 | |
2644 | | - /* |
2645 | | - * @deprecated since 1.18 |
2646 | | - */ |
| 2653 | + /** |
| 2654 | + * @deprecated since 1.18 |
| 2655 | + */ |
2647 | 2656 | public function viewUpdates() { |
2648 | 2657 | global $wgUser; |
2649 | 2658 | return $this->doViewUpdates( $wgUser ); |
2650 | 2659 | } |
2651 | 2660 | |
2652 | | - /* |
2653 | | - * @deprecated since 1.18 |
2654 | | - */ |
| 2661 | + /** |
| 2662 | + * @deprecated since 1.18 |
| 2663 | + */ |
2655 | 2664 | public function useParserCache( $oldid ) { |
2656 | 2665 | global $wgUser; |
2657 | 2666 | return $this->isParserCacheUsed( $wgUser, $oldid ); |
Index: trunk/phase3/includes/ZipDirectoryReader.php |
— | — | @@ -1,8 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * A class for reading ZIP file directories, for the purposes of upload |
6 | | - * verification. |
| 5 | + * A class for reading ZIP file directories, for the purposes of upload |
| 6 | + * verification. |
7 | 7 | * |
8 | 8 | * Only a functional interface is provided: ZipFileReader::read(). No access is |
9 | 9 | * given to object instances. |
— | — | @@ -12,7 +12,7 @@ |
13 | 13 | /** |
14 | 14 | * Read a ZIP file and call a function for each file discovered in it. |
15 | 15 | * |
16 | | - * Because this class is aimed at verification, an error is raised on |
| 16 | + * Because this class is aimed at verification, an error is raised on |
17 | 17 | * suspicious or ambiguous input, instead of emulating some standard |
18 | 18 | * behaviour. |
19 | 19 | * |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | * @param $callback Array The callback function. It will be called for each file |
22 | 22 | * with a single associative array each time, with members: |
23 | 23 | * |
24 | | - * - name: The file name. Directories conventionally have a trailing |
| 24 | + * - name: The file name. Directories conventionally have a trailing |
25 | 25 | * slash. |
26 | 26 | * |
27 | 27 | * - mtime: The file modification time, in MediaWiki 14-char format |
— | — | @@ -30,18 +30,18 @@ |
31 | 31 | * @param $options Array An associative array of read options, with the option |
32 | 32 | * name in the key. This may currently contain: |
33 | 33 | * |
34 | | - * - zip64: If this is set to true, then we will emulate a |
35 | | - * library with ZIP64 support, like OpenJDK 7. If it is set to |
36 | | - * false, then we will emulate a library with no knowledge of |
| 34 | + * - zip64: If this is set to true, then we will emulate a |
| 35 | + * library with ZIP64 support, like OpenJDK 7. If it is set to |
| 36 | + * false, then we will emulate a library with no knowledge of |
37 | 37 | * ZIP64. |
38 | 38 | * |
39 | | - * NOTE: The ZIP64 code is untested and probably doesn't work. It |
40 | | - * turned out to be easier to just reject ZIP64 archive uploads, |
41 | | - * since they are likely to be very rare. Confirming safety of a |
42 | | - * ZIP64 file is fairly complex. What do you do with a file that is |
43 | | - * ambiguous and broken when read with a non-ZIP64 reader, but valid |
44 | | - * when read with a ZIP64 reader? This situation is normal for a |
45 | | - * valid ZIP64 file, and working out what non-ZIP64 readers will make |
| 39 | + * NOTE: The ZIP64 code is untested and probably doesn't work. It |
| 40 | + * turned out to be easier to just reject ZIP64 archive uploads, |
| 41 | + * since they are likely to be very rare. Confirming safety of a |
| 42 | + * ZIP64 file is fairly complex. What do you do with a file that is |
| 43 | + * ambiguous and broken when read with a non-ZIP64 reader, but valid |
| 44 | + * when read with a ZIP64 reader? This situation is normal for a |
| 45 | + * valid ZIP64 file, and working out what non-ZIP64 readers will make |
46 | 46 | * of such a file is not trivial. |
47 | 47 | * |
48 | 48 | * @return Status object. The following fatal errors are defined: |
— | — | @@ -50,20 +50,20 @@ |
51 | 51 | * |
52 | 52 | * - zip-wrong-format: The file does not appear to be a ZIP file. |
53 | 53 | * |
54 | | - * - zip-bad: There was something wrong or ambiguous about the file |
| 54 | + * - zip-bad: There was something wrong or ambiguous about the file |
55 | 55 | * data. |
56 | 56 | * |
57 | | - * - zip-unsupported: The ZIP file uses features which |
| 57 | + * - zip-unsupported: The ZIP file uses features which |
58 | 58 | * ZipDirectoryReader does not support. |
59 | 59 | * |
60 | | - * The default messages for those fatal errors are written in a way that |
| 60 | + * The default messages for those fatal errors are written in a way that |
61 | 61 | * makes sense for upload verification. |
62 | 62 | * |
63 | | - * If a fatal error is returned, more information about the error will be |
| 63 | + * If a fatal error is returned, more information about the error will be |
64 | 64 | * available in the debug log. |
65 | 65 | * |
66 | 66 | * Note that the callback function may be called any number of times before |
67 | | - * a fatal error is returned. If this occurs, the data sent to the callback |
| 67 | + * a fatal error is returned. If this occurs, the data sent to the callback |
68 | 68 | * function should be discarded. |
69 | 69 | */ |
70 | 70 | public static function read( $fileName, $callback, $options = array() ) { |
— | — | @@ -92,6 +92,8 @@ |
93 | 93 | /** Stored headers */ |
94 | 94 | var $eocdr, $eocdr64, $eocdr64Locator; |
95 | 95 | |
| 96 | + var $data; |
| 97 | + |
96 | 98 | /** The "extra field" ID for ZIP64 central directory entries */ |
97 | 99 | const ZIP64_EXTRA_HEADER = 0x0001; |
98 | 100 | |
— | — | @@ -104,7 +106,6 @@ |
105 | 107 | /** The index of the "general field" bit for central directory encryption */ |
106 | 108 | const GENERAL_CD_ENCRYPTED = 13; |
107 | 109 | |
108 | | - |
109 | 110 | /** |
110 | 111 | * Private constructor |
111 | 112 | */ |
— | — | @@ -165,8 +166,8 @@ |
166 | 167 | } |
167 | 168 | |
168 | 169 | /** |
169 | | - * Read the header which is at the end of the central directory, |
170 | | - * unimaginatively called the "end of central directory record" by the ZIP |
| 170 | + * Read the header which is at the end of the central directory, |
| 171 | + * unimaginatively called the "end of central directory record" by the ZIP |
171 | 172 | * spec. |
172 | 173 | */ |
173 | 174 | function readEndOfCentralDirectoryRecord() { |
— | — | @@ -189,7 +190,7 @@ |
190 | 191 | $block = $this->getBlock( $startPos ); |
191 | 192 | $sigPos = strrpos( $block, "PK\x05\x06" ); |
192 | 193 | if ( $sigPos === false ) { |
193 | | - $this->error( 'zip-wrong-format', |
| 194 | + $this->error( 'zip-wrong-format', |
194 | 195 | "zip file lacks EOCDR signature. It probably isn't a zip file." ); |
195 | 196 | } |
196 | 197 | |
— | — | @@ -212,7 +213,7 @@ |
213 | 214 | } |
214 | 215 | |
215 | 216 | /** |
216 | | - * Read the header called the "ZIP64 end of central directory locator". An |
| 217 | + * Read the header called the "ZIP64 end of central directory locator". An |
217 | 218 | * error will be raised if it does not exist. |
218 | 219 | */ |
219 | 220 | function readZip64EndOfCentralDirectoryLocator() { |
— | — | @@ -224,20 +225,20 @@ |
225 | 226 | ); |
226 | 227 | $structSize = $this->getStructSize( $info ); |
227 | 228 | |
228 | | - $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size'] |
| 229 | + $block = $this->getBlock( $this->getFileLength() - $this->eocdr['EOCDR size'] |
229 | 230 | - $structSize, $structSize ); |
230 | 231 | $this->eocdr64Locator = $data = $this->unpack( $block, $info ); |
231 | 232 | |
232 | 233 | if ( $data['signature'] !== "PK\x06\x07" ) { |
233 | | - // Note: Java will allow this and continue to read the |
234 | | - // EOCDR64, so we have to reject the upload, we can't |
| 234 | + // Note: Java will allow this and continue to read the |
| 235 | + // EOCDR64, so we have to reject the upload, we can't |
235 | 236 | // just use the EOCDR header instead. |
236 | 237 | $this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory locator' ); |
237 | 238 | } |
238 | 239 | } |
239 | 240 | |
240 | 241 | /** |
241 | | - * Read the header called the "ZIP64 end of central directory record". It |
| 242 | + * Read the header called the "ZIP64 end of central directory record". It |
242 | 243 | * may replace the regular "end of central directory record" in ZIP64 files. |
243 | 244 | */ |
244 | 245 | function readZip64EndOfCentralDirectoryRecord() { |
— | — | @@ -266,14 +267,14 @@ |
267 | 268 | $this->error( 'zip-bad', 'wrong signature on Zip64 end of central directory record' ); |
268 | 269 | } |
269 | 270 | if ( $data['disk'] !== 0 |
270 | | - || $data['CD start disk'] !== 0 ) |
| 271 | + || $data['CD start disk'] !== 0 ) |
271 | 272 | { |
272 | 273 | $this->error( 'zip-unsupported', 'more than one disk (in EOCDR64)' ); |
273 | 274 | } |
274 | 275 | } |
275 | 276 | |
276 | 277 | /** |
277 | | - * Find the location of the central directory, as would be seen by a |
| 278 | + * Find the location of the central directory, as would be seen by a |
278 | 279 | * non-ZIP64 reader. |
279 | 280 | * |
280 | 281 | * @return List containing offset, size and end position. |
— | — | @@ -286,27 +287,27 @@ |
287 | 288 | // Some readers use the EOCDR position instead of the offset field |
288 | 289 | // to find the directory, so to be safe, we check if they both agree. |
289 | 290 | if ( $offset + $size != $endPos ) { |
290 | | - $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . |
| 291 | + $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . |
291 | 292 | 'of central directory record' ); |
292 | 293 | } |
293 | 294 | return array( $offset, $size ); |
294 | 295 | } |
295 | 296 | |
296 | 297 | /** |
297 | | - * Find the location of the central directory, as would be seen by a |
| 298 | + * Find the location of the central directory, as would be seen by a |
298 | 299 | * ZIP64-compliant reader. |
299 | 300 | * |
300 | 301 | * @return List containing offset, size and end position. |
301 | 302 | */ |
302 | 303 | function findZip64CentralDirectory() { |
303 | | - // The spec is ambiguous about the exact rules of precedence between the |
304 | | - // ZIP64 headers and the original headers. Here we follow zip_util.c |
| 304 | + // The spec is ambiguous about the exact rules of precedence between the |
| 305 | + // ZIP64 headers and the original headers. Here we follow zip_util.c |
305 | 306 | // from OpenJDK 7. |
306 | 307 | $size = $this->eocdr['CD size']; |
307 | 308 | $offset = $this->eocdr['CD offset']; |
308 | 309 | $numEntries = $this->eocdr['CD entries total']; |
309 | 310 | $endPos = $this->eocdr['position']; |
310 | | - if ( $size == 0xffffffff |
| 311 | + if ( $size == 0xffffffff |
311 | 312 | || $offset == 0xffffffff |
312 | 313 | || $numEntries == 0xffff ) |
313 | 314 | { |
— | — | @@ -324,7 +325,7 @@ |
325 | 326 | // Some readers use the EOCDR position instead of the offset field |
326 | 327 | // to find the directory, so to be safe, we check if they both agree. |
327 | 328 | if ( $offset + $size != $endPos ) { |
328 | | - $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . |
| 329 | + $this->error( 'zip-bad', 'the central directory does not immediately precede the end ' . |
329 | 330 | 'of central directory record' ); |
330 | 331 | } |
331 | 332 | return array( $offset, $size ); |
— | — | @@ -390,7 +391,7 @@ |
391 | 392 | } |
392 | 393 | |
393 | 394 | // Convert the timestamp into MediaWiki format |
394 | | - // For the format, please see the MS-DOS 2.0 Programmer's Reference, |
| 395 | + // For the format, please see the MS-DOS 2.0 Programmer's Reference, |
395 | 396 | // pages 3-5 and 3-6. |
396 | 397 | $time = $data['mod time']; |
397 | 398 | $date = $data['mod date']; |
— | — | @@ -405,8 +406,8 @@ |
406 | 407 | $year, $month, $day, $hour, $minute, $second ); |
407 | 408 | |
408 | 409 | // Convert the character set in the file name |
409 | | - if ( !function_exists( 'iconv' ) |
410 | | - || $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) ) |
| 410 | + if ( !function_exists( 'iconv' ) |
| 411 | + || $this->testBit( $data['general bits'], self::GENERAL_UTF8 ) ) |
411 | 412 | { |
412 | 413 | $name = $data['name']; |
413 | 414 | } else { |
— | — | @@ -444,7 +445,7 @@ |
445 | 446 | while ( $extraPos < strlen( $extraField ) ) { |
446 | 447 | $extra = $this->unpack( $extraField, $extraHeaderInfo, $extraPos ); |
447 | 448 | $extraPos += $extraHeaderSize; |
448 | | - $extra += $this->unpack( $extraField, |
| 449 | + $extra += $this->unpack( $extraField, |
449 | 450 | array( 'data' => array( 'string', $extra['size'] ) ), |
450 | 451 | $extraPos ); |
451 | 452 | $extraPos += $extra['size']; |
— | — | @@ -473,7 +474,7 @@ |
474 | 475 | * in the file to satisfy the request, an exception will be thrown. |
475 | 476 | * |
476 | 477 | * @param $start The byte offset of the start of the block. |
477 | | - * @param $length The number of bytes to return. If omitted, the remainder |
| 478 | + * @param $length The number of bytes to return. If omitted, the remainder |
478 | 479 | * of the file will be returned. |
479 | 480 | * |
480 | 481 | * @return string |
— | — | @@ -500,10 +501,10 @@ |
501 | 502 | $block .= $this->getSegment( $segIndex ); |
502 | 503 | } |
503 | 504 | |
504 | | - $block = substr( $block, |
| 505 | + $block = substr( $block, |
505 | 506 | $start - $startSeg * self::SEGSIZE, |
506 | 507 | $length ); |
507 | | - |
| 508 | + |
508 | 509 | if ( strlen( $block ) < $length ) { |
509 | 510 | $this->error( 'zip-bad', 'getBlock() returned an unexpectedly small amount of data' ); |
510 | 511 | } |
— | — | @@ -512,12 +513,12 @@ |
513 | 514 | } |
514 | 515 | |
515 | 516 | /** |
516 | | - * Get a section of the file starting at position $segIndex * self::SEGSIZE, |
517 | | - * of length self::SEGSIZE. The result is cached. This is a helper function |
| 517 | + * Get a section of the file starting at position $segIndex * self::SEGSIZE, |
| 518 | + * of length self::SEGSIZE. The result is cached. This is a helper function |
518 | 519 | * for getBlock(). |
519 | 520 | * |
520 | | - * If there are not enough bytes in the file to satsify the request, the |
521 | | - * return value will be truncated. If a request is made for a segment beyond |
| 521 | + * If there are not enough bytes in the file to satsify the request, the |
| 522 | + * return value will be truncated. If a request is made for a segment beyond |
522 | 523 | * the end of the file, an empty string will be returned. |
523 | 524 | */ |
524 | 525 | function getSegment( $segIndex ) { |
— | — | @@ -556,25 +557,25 @@ |
557 | 558 | } |
558 | 559 | |
559 | 560 | /** |
560 | | - * Unpack a binary structure. This is like the built-in unpack() function |
| 561 | + * Unpack a binary structure. This is like the built-in unpack() function |
561 | 562 | * except nicer. |
562 | 563 | * |
563 | 564 | * @param $string The binary data input |
564 | 565 | * |
565 | | - * @param $struct An associative array giving structure members and their |
566 | | - * types. In the key is the field name. The value may be either an |
567 | | - * integer, in which case the field is a little-endian unsigned integer |
568 | | - * encoded in the given number of bytes, or an array, in which case the |
569 | | - * first element of the array is the type name, and the subsequent |
| 566 | + * @param $struct An associative array giving structure members and their |
| 567 | + * types. In the key is the field name. The value may be either an |
| 568 | + * integer, in which case the field is a little-endian unsigned integer |
| 569 | + * encoded in the given number of bytes, or an array, in which case the |
| 570 | + * first element of the array is the type name, and the subsequent |
570 | 571 | * elements are type-dependent parameters. Only one such type is defined: |
571 | | - * - "string": The second array element gives the length of string. |
| 572 | + * - "string": The second array element gives the length of string. |
572 | 573 | * Not null terminated. |
573 | 574 | * |
574 | 575 | * @param $offset The offset into the string at which to start unpacking. |
575 | 576 | * |
576 | | - * @return Unpacked associative array. Note that large integers in the input |
577 | | - * may be represented as floating point numbers in the return value, so |
578 | | - * the use of weak comparison is advised. |
| 577 | + * @return Unpacked associative array. Note that large integers in the input |
| 578 | + * may be represented as floating point numbers in the return value, so |
| 579 | + * the use of weak comparison is advised. |
579 | 580 | */ |
580 | 581 | function unpack( $string, $struct, $offset = 0 ) { |
581 | 582 | $size = $this->getStructSize( $struct ); |
— | — | @@ -600,8 +601,8 @@ |
601 | 602 | $length = intval( $type ); |
602 | 603 | $bytes = substr( $string, $pos, $length ); |
603 | 604 | |
604 | | - // Calculate the value. Use an algorithm which automatically |
605 | | - // upgrades the value to floating point if necessary. |
| 605 | + // Calculate the value. Use an algorithm which automatically |
| 606 | + // upgrades the value to floating point if necessary. |
606 | 607 | $value = 0; |
607 | 608 | for ( $i = $length - 1; $i >= 0; $i-- ) { |
608 | 609 | $value *= 256; |
— | — | @@ -623,7 +624,7 @@ |
624 | 625 | } |
625 | 626 | |
626 | 627 | /** |
627 | | - * Returns a bit from a given position in an integer value, converted to |
| 628 | + * Returns a bit from a given position in an integer value, converted to |
628 | 629 | * boolean. |
629 | 630 | * |
630 | 631 | * @param $value integer |
— | — | @@ -678,6 +679,9 @@ |
679 | 680 | parent::__construct( "ZipDirectoryReader error: $code" ); |
680 | 681 | } |
681 | 682 | |
| 683 | + /** |
| 684 | + * @return mixed |
| 685 | + */ |
682 | 686 | function getErrorCode() { |
683 | 687 | return $this->code; |
684 | 688 | } |
Index: trunk/phase3/index.php5 |
— | — | @@ -1 +1 @@ |
2 | | -<?php require './index.php'; |
\ No newline at end of file |
| 2 | +<?php require './index.php'; |
Index: trunk/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -222,7 +222,7 @@ |
223 | 223 | |
224 | 224 | /* Public Members */ |
225 | 225 | |
226 | | - /* |
| 226 | + /** |
227 | 227 | * Dummy function which in debug mode can be replaced with a function that |
228 | 228 | * emulates console.log in console-less environments. |
229 | 229 | */ |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | */ |
251 | 251 | this.libs = {}; |
252 | 252 | |
253 | | - /* |
| 253 | + /** |
254 | 254 | * Localization system |
255 | 255 | */ |
256 | 256 | this.messages = new this.Map(); |
— | — | @@ -556,7 +556,7 @@ |
557 | 557 | callback(); |
558 | 558 | return; |
559 | 559 | } |
560 | | - |
| 560 | + |
561 | 561 | addScript( arr[i], function() { |
562 | 562 | nestedAddScript( arr, callback, i + 1 ); |
563 | 563 | } ); |
— | — | @@ -1175,7 +1175,7 @@ |
1176 | 1176 | } ); |
1177 | 1177 | return names; |
1178 | 1178 | }; |
1179 | | - |
| 1179 | + |
1180 | 1180 | /** |
1181 | 1181 | * For backwards-compatibility with Squid-cached pages. Loads mw.user |
1182 | 1182 | */ |