Index: branches/REL1_19/phase3/maintenance/purgeList.php |
— | — | @@ -47,7 +47,7 @@ |
48 | 48 | |
49 | 49 | while ( !feof( $stdin ) ) { |
50 | 50 | $page = trim( fgets( $stdin ) ); |
51 | | - if ( substr( $page, 0, 7 ) == 'http://' ) { |
| 51 | + if ( preg_match( '%^https?://%', $page ) ) { |
52 | 52 | $urls[] = $page; |
53 | 53 | } elseif ( $page !== '' ) { |
54 | 54 | $title = Title::newFromText( $page ); |
Index: branches/REL1_19/phase3/includes/filerepo/backend/SwiftFileBackend.php |
— | — | @@ -792,7 +792,11 @@ |
793 | 793 | */ |
794 | 794 | protected function logException( Exception $e, $func, array $params ) { |
795 | 795 | wfDebugLog( 'SwiftBackend', |
796 | | - get_class( $e ) . " in '{$this->name}': '{$func}' with " . serialize( $params ) |
| 796 | + get_class( $e ) . " in '{$func}' (given '" . serialize( $params ) . "')" . |
| 797 | + ( $e instanceof InvalidResponseException |
| 798 | + ? ": {$e->getMessage()}" |
| 799 | + : "" |
| 800 | + ) |
797 | 801 | ); |
798 | 802 | } |
799 | 803 | } |
Index: branches/REL1_19/phase3/includes/OutputPage.php |
— | — | @@ -2501,7 +2501,7 @@ |
2502 | 2502 | * @param $only String ResourceLoaderModule TYPE_ class constant |
2503 | 2503 | * @param $useESI boolean |
2504 | 2504 | * @param $extraQuery Array with extra query parameters to add to each request. array( param => value ) |
2505 | | - * @param $loadCall boolean If true, output a mw.loader.load() call rather than a <script src="..."> tag |
| 2505 | + * @param $loadCall boolean If true, output an (asynchronous) mw.loader.load() call rather than a <script src="..."> tag |
2506 | 2506 | * @return string html <script> and <style> tags |
2507 | 2507 | */ |
2508 | 2508 | protected function makeResourceLoaderLink( $modules, $only, $useESI = false, array $extraQuery = array(), $loadCall = false ) { |
— | — | @@ -2644,7 +2644,7 @@ |
2645 | 2645 | } else if ( $loadCall ) { |
2646 | 2646 | $link = Html::inlineScript( |
2647 | 2647 | ResourceLoader::makeLoaderConditionalScript( |
2648 | | - Xml::encodeJsCall( 'mw.loader.load', array( $url ) ) |
| 2648 | + Xml::encodeJsCall( 'mw.loader.load', array( $url, 'text/javascript', true ) ) |
2649 | 2649 | ) |
2650 | 2650 | ); |
2651 | 2651 | } else { |
— | — | @@ -2697,7 +2697,7 @@ |
2698 | 2698 | if ( $modules ) { |
2699 | 2699 | $scripts .= Html::inlineScript( |
2700 | 2700 | ResourceLoader::makeLoaderConditionalScript( |
2701 | | - Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) ) |
| 2701 | + Xml::encodeJsCall( 'mw.loader.load', array( $modules ) ) |
2702 | 2702 | ) |
2703 | 2703 | ); |
2704 | 2704 | } |
— | — | @@ -2739,7 +2739,7 @@ |
2740 | 2740 | if ( $modules ) { |
2741 | 2741 | $scripts .= Html::inlineScript( |
2742 | 2742 | ResourceLoader::makeLoaderConditionalScript( |
2743 | | - Xml::encodeJsCall( 'mw.loader.load', array( $modules ) ) |
| 2743 | + Xml::encodeJsCall( 'mw.loader.load', array( $modules, null, true ) ) |
2744 | 2744 | ) |
2745 | 2745 | ); |
2746 | 2746 | } |
Property changes on: branches/REL1_19/phase3/includes/OutputPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
2747 | 2747 | Merged /trunk/phase3/includes/OutputPage.php:r111597,111658 |
Index: branches/REL1_19/phase3/includes/Cdb_PHP.php |
— | — | @@ -82,6 +82,9 @@ |
83 | 83 | * CDB reader class |
84 | 84 | */ |
85 | 85 | class CdbReader_PHP extends CdbReader { |
| 86 | + /** The filename */ |
| 87 | + var $fileName; |
| 88 | + |
86 | 89 | /** The file handle */ |
87 | 90 | var $handle; |
88 | 91 | |
— | — | @@ -110,9 +113,10 @@ |
111 | 114 | * @param $fileName string |
112 | 115 | */ |
113 | 116 | function __construct( $fileName ) { |
| 117 | + $this->fileName = $fileName; |
114 | 118 | $this->handle = fopen( $fileName, 'rb' ); |
115 | 119 | if ( !$this->handle ) { |
116 | | - throw new MWException( 'Unable to open CDB file "' . $fileName . '"' ); |
| 120 | + throw new MWException( 'Unable to open CDB file "' . $this->fileName . '".' ); |
117 | 121 | } |
118 | 122 | $this->findStart(); |
119 | 123 | } |
— | — | @@ -160,7 +164,8 @@ |
161 | 165 | protected function read( $length, $pos ) { |
162 | 166 | if ( fseek( $this->handle, $pos ) == -1 ) { |
163 | 167 | // This can easily happen if the internal pointers are incorrect |
164 | | - throw new MWException( __METHOD__.': seek failed, file may be corrupted.' ); |
| 168 | + throw new MWException( |
| 169 | + 'Seek failed, file "' . $this->fileName . '" may be corrupted.' ); |
165 | 170 | } |
166 | 171 | |
167 | 172 | if ( $length == 0 ) { |
— | — | @@ -169,7 +174,8 @@ |
170 | 175 | |
171 | 176 | $buf = fread( $this->handle, $length ); |
172 | 177 | if ( $buf === false || strlen( $buf ) !== $length ) { |
173 | | - throw new MWException( __METHOD__.': read from CDB file failed, file may be corrupted' ); |
| 178 | + throw new MWException( |
| 179 | + 'Read from CDB file failed, file "' . $this->fileName . '" may be corrupted.' ); |
174 | 180 | } |
175 | 181 | return $buf; |
176 | 182 | } |
— | — | @@ -182,7 +188,8 @@ |
183 | 189 | protected function unpack31( $s ) { |
184 | 190 | $data = unpack( 'V', $s ); |
185 | 191 | if ( $data[1] > 0x7fffffff ) { |
186 | | - throw new MWException( __METHOD__.': error in CDB file, integer too big' ); |
| 192 | + throw new MWException( |
| 193 | + 'Error in CDB file "' . $this->fileName . '", integer too big.' ); |
187 | 194 | } |
188 | 195 | return $data[1]; |
189 | 196 | } |
— | — | @@ -270,13 +277,14 @@ |
271 | 278 | $this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff ); |
272 | 279 | $this->handle = fopen( $this->tmpFileName, 'wb' ); |
273 | 280 | if ( !$this->handle ) { |
274 | | - throw new MWException( 'Unable to open CDB file for write "' . $fileName . '"' ); |
| 281 | + $this->throwException( |
| 282 | + 'Unable to open CDB file "' . $this->tmpFileName . '" for write.' ); |
275 | 283 | } |
276 | 284 | $this->hplist = array(); |
277 | 285 | $this->numentries = 0; |
278 | 286 | $this->pos = 2048; // leaving space for the pointer array, 256 * 8 |
279 | 287 | if ( fseek( $this->handle, $this->pos ) == -1 ) { |
280 | | - throw new MWException( __METHOD__.': fseek failed' ); |
| 288 | + $this->throwException( 'fseek failed in file "' . $this->tmpFileName . '".' ); |
281 | 289 | } |
282 | 290 | } |
283 | 291 | |
— | — | @@ -314,7 +322,7 @@ |
315 | 323 | unlink( $this->realFileName ); |
316 | 324 | } |
317 | 325 | if ( !rename( $this->tmpFileName, $this->realFileName ) ) { |
318 | | - throw new MWException( 'Unable to move the new CDB file into place.' ); |
| 326 | + $this->throwException( 'Unable to move the new CDB file into place.' ); |
319 | 327 | } |
320 | 328 | unset( $this->handle ); |
321 | 329 | } |
— | — | @@ -326,7 +334,7 @@ |
327 | 335 | protected function write( $buf ) { |
328 | 336 | $len = fwrite( $this->handle, $buf ); |
329 | 337 | if ( $len !== strlen( $buf ) ) { |
330 | | - throw new MWException( 'Error writing to CDB file.' ); |
| 338 | + $this->throwException( 'Error writing to CDB file "'.$this->tmpFileName.'".' ); |
331 | 339 | } |
332 | 340 | } |
333 | 341 | |
— | — | @@ -337,7 +345,8 @@ |
338 | 346 | protected function posplus( $len ) { |
339 | 347 | $newpos = $this->pos + $len; |
340 | 348 | if ( $newpos > 0x7fffffff ) { |
341 | | - throw new MWException( 'A value in the CDB file is too large' ); |
| 349 | + $this->throwException( |
| 350 | + 'A value in the CDB file "'.$this->tmpFileName.'" is too large.' ); |
342 | 351 | } |
343 | 352 | $this->pos = $newpos; |
344 | 353 | } |
— | — | @@ -366,10 +375,10 @@ |
367 | 376 | */ |
368 | 377 | protected function addbegin( $keylen, $datalen ) { |
369 | 378 | if ( $keylen > 0x7fffffff ) { |
370 | | - throw new MWException( __METHOD__.': key length too long' ); |
| 379 | + $this->throwException( 'Key length too long in file "'.$this->tmpFileName.'".' ); |
371 | 380 | } |
372 | 381 | if ( $datalen > 0x7fffffff ) { |
373 | | - throw new MWException( __METHOD__.': data length too long' ); |
| 382 | + $this->throwException( 'Data length too long in file "'.$this->tmpFileName.'".' ); |
374 | 383 | } |
375 | 384 | $buf = pack( 'VV', $keylen, $datalen ); |
376 | 385 | $this->write( $buf ); |
— | — | @@ -444,8 +453,22 @@ |
445 | 454 | // Write the pointer array at the start of the file |
446 | 455 | rewind( $this->handle ); |
447 | 456 | if ( ftell( $this->handle ) != 0 ) { |
448 | | - throw new MWException( __METHOD__.': Error rewinding to start of file' ); |
| 457 | + $this->throwException( 'Error rewinding to start of file "'.$this->tmpFileName.'".' ); |
449 | 458 | } |
450 | 459 | $this->write( $final ); |
451 | 460 | } |
| 461 | + |
| 462 | + /** |
| 463 | + * Clean up the temp file and throw an exception |
| 464 | + * |
| 465 | + * @param $msg string |
| 466 | + * @throws MWException |
| 467 | + */ |
| 468 | + protected function throwException( $msg ) { |
| 469 | + if ( $this->handle ) { |
| 470 | + fclose( $this->handle ); |
| 471 | + unlink( $this->tmpFileName ); |
| 472 | + } |
| 473 | + throw new MWException( $msg ); |
| 474 | + } |
452 | 475 | } |
Property changes on: branches/REL1_19/phase3/includes |
___________________________________________________________________ |
Modified: svn:mergeinfo |
453 | 476 | Merged /trunk/phase3/includes:r111571,111574,111597,111658 |
Index: branches/REL1_19/phase3/resources/mediawiki/mediawiki.js |
— | — | @@ -620,14 +620,14 @@ |
621 | 621 | |
622 | 622 | /** |
623 | 623 | * Adds a script tag to the DOM, either using document.write or low-level DOM manipulation, |
624 | | - * depending on whether document-ready has occured yet and whether we are in blocking mode. |
| 624 | + * depending on whether document-ready has occured yet and whether we are in async mode. |
625 | 625 | * |
626 | 626 | * @param src String: URL to script, will be used as the src attribute in the script tag |
627 | 627 | * @param callback Function: Optional callback which will be run when the script is done |
628 | 628 | */ |
629 | | - function addScript( src, callback, blocking ) { |
| 629 | + function addScript( src, callback, async ) { |
630 | 630 | var done = false, script, head; |
631 | | - if ( ready || !blocking ) { |
| 631 | + if ( ready || async ) { |
632 | 632 | // jQuery's getScript method is NOT better than doing this the old-fashioned way |
633 | 633 | // because jQuery will eval the script's code, and errors will not have sane |
634 | 634 | // line numbers. |
— | — | @@ -738,7 +738,7 @@ |
739 | 739 | callback(); |
740 | 740 | } |
741 | 741 | }; |
742 | | - nestedAddScript = function ( arr, callback, blocking, i ) { |
| 742 | + nestedAddScript = function ( arr, callback, async, i ) { |
743 | 743 | // Recursively call addScript() in its own callback |
744 | 744 | // for each element of arr. |
745 | 745 | if ( i >= arr.length ) { |
— | — | @@ -748,13 +748,13 @@ |
749 | 749 | } |
750 | 750 | |
751 | 751 | addScript( arr[i], function() { |
752 | | - nestedAddScript( arr, callback, blocking, i + 1 ); |
753 | | - }, blocking ); |
| 752 | + nestedAddScript( arr, callback, async, i + 1 ); |
| 753 | + }, async ); |
754 | 754 | }; |
755 | 755 | |
756 | 756 | if ( $.isArray( script ) ) { |
757 | 757 | registry[module].state = 'loading'; |
758 | | - nestedAddScript( script, markModuleReady, registry[module].blocking, 0 ); |
| 758 | + nestedAddScript( script, markModuleReady, registry[module].async, 0 ); |
759 | 759 | } else if ( $.isFunction( script ) ) { |
760 | 760 | script( $ ); |
761 | 761 | markModuleReady(); |
— | — | @@ -777,10 +777,10 @@ |
778 | 778 | * @param dependencies string module name or array of string module names |
779 | 779 | * @param ready function callback to execute when all dependencies are ready |
780 | 780 | * @param error function callback to execute when any dependency fails |
781 | | - * @param blocking (optional) If true, load modules in a blocking fashion if |
782 | | - * document ready has not yet occurred |
| 781 | + * @param async (optional) If true, load modules asynchronously even if |
| 782 | + * document ready has not yet occurred |
783 | 783 | */ |
784 | | - function request( dependencies, ready, error, blocking ) { |
| 784 | + function request( dependencies, ready, error, async ) { |
785 | 785 | var regItemDeps, regItemDepLen, n; |
786 | 786 | |
787 | 787 | // Allow calling by single module name |
— | — | @@ -812,9 +812,9 @@ |
813 | 813 | for ( n = 0; n < dependencies.length; n += 1 ) { |
814 | 814 | if ( $.inArray( dependencies[n], queue ) === -1 ) { |
815 | 815 | queue[queue.length] = dependencies[n]; |
816 | | - if ( blocking ) { |
817 | | - // Mark this module as blocking in the registry |
818 | | - registry[dependencies[n]].blocking = true; |
| 816 | + if ( async ) { |
| 817 | + // Mark this module as async in the registry |
| 818 | + registry[dependencies[n]].async = true; |
819 | 819 | } |
820 | 820 | } |
821 | 821 | } |
— | — | @@ -855,9 +855,9 @@ |
856 | 856 | * @param moduleMap {Object}: Module map, see buildModulesString() |
857 | 857 | * @param currReqBase {Object}: Object with other parameters (other than 'modules') to use in the request |
858 | 858 | * @param sourceLoadScript {String}: URL of load.php |
859 | | - * @param blocking {Boolean}: If true, use a blocking request if document ready has not yet occurred |
| 859 | + * @param async {Boolean}: If true, use an asynchrounous request even if document ready has not yet occurred |
860 | 860 | */ |
861 | | - function doRequest( moduleMap, currReqBase, sourceLoadScript, blocking ) { |
| 861 | + function doRequest( moduleMap, currReqBase, sourceLoadScript, async ) { |
862 | 862 | var request = $.extend( |
863 | 863 | { 'modules': buildModulesString( moduleMap ) }, |
864 | 864 | currReqBase |
— | — | @@ -865,7 +865,7 @@ |
866 | 866 | request = sortQuery( request ); |
867 | 867 | // Asynchronously append a script tag to the end of the body |
868 | 868 | // Append &* to avoid triggering the IE6 extension check |
869 | | - addScript( sourceLoadScript + '?' + $.param( request ) + '&*', null, blocking ); |
| 869 | + addScript( sourceLoadScript + '?' + $.param( request ) + '&*', null, async ); |
870 | 870 | } |
871 | 871 | |
872 | 872 | /* Public Methods */ |
— | — | @@ -877,7 +877,7 @@ |
878 | 878 | var reqBase, splits, maxQueryLength, q, b, bSource, bGroup, bSourceGroup, |
879 | 879 | source, group, g, i, modules, maxVersion, sourceLoadScript, |
880 | 880 | currReqBase, currReqBaseLength, moduleMap, l, |
881 | | - lastDotIndex, prefix, suffix, bytesAdded, blocking; |
| 881 | + lastDotIndex, prefix, suffix, bytesAdded, async; |
882 | 882 | |
883 | 883 | // Build a list of request parameters common to all requests. |
884 | 884 | reqBase = { |
— | — | @@ -954,7 +954,7 @@ |
955 | 955 | |
956 | 956 | currReqBase = $.extend( { 'version': formatVersionNumber( maxVersion ) }, reqBase ); |
957 | 957 | currReqBaseLength = $.param( currReqBase ).length; |
958 | | - blocking = false; |
| 958 | + async = true; |
959 | 959 | // We may need to split up the request to honor the query string length limit, |
960 | 960 | // so build it piece by piece. |
961 | 961 | l = currReqBaseLength + 9; // '&modules='.length == 9 |
— | — | @@ -976,26 +976,26 @@ |
977 | 977 | if ( maxQueryLength > 0 && !$.isEmptyObject( moduleMap ) && l + bytesAdded > maxQueryLength ) { |
978 | 978 | // This request would become too long, create a new one |
979 | 979 | // and fire off the old one |
980 | | - doRequest( moduleMap, currReqBase, sourceLoadScript, blocking ); |
| 980 | + doRequest( moduleMap, currReqBase, sourceLoadScript, async ); |
981 | 981 | moduleMap = {}; |
982 | | - blocking = false; |
| 982 | + async = true; |
983 | 983 | l = currReqBaseLength + 9; |
984 | 984 | } |
985 | 985 | if ( moduleMap[prefix] === undefined ) { |
986 | 986 | moduleMap[prefix] = []; |
987 | 987 | } |
988 | 988 | moduleMap[prefix].push( suffix ); |
989 | | - if ( registry[modules[i]].blocking ) { |
| 989 | + if ( !registry[modules[i]].async ) { |
990 | 990 | // If this module is blocking, make the entire request blocking |
991 | 991 | // This is slightly suboptimal, but in practice mixing of blocking |
992 | | - // and non-blocking modules will only occur in debug mode. |
993 | | - blocking = true; |
| 992 | + // and async modules will only occur in debug mode. |
| 993 | + async = false; |
994 | 994 | } |
995 | 995 | l += bytesAdded; |
996 | 996 | } |
997 | 997 | // If there's anything left in moduleMap, request that too |
998 | 998 | if ( !$.isEmptyObject( moduleMap ) ) { |
999 | | - doRequest( moduleMap, currReqBase, sourceLoadScript, blocking ); |
| 999 | + doRequest( moduleMap, currReqBase, sourceLoadScript, async ); |
1000 | 1000 | } |
1001 | 1001 | } |
1002 | 1002 | } |
— | — | @@ -1177,10 +1177,11 @@ |
1178 | 1178 | * @param type {String} mime-type to use if calling with a URL of an |
1179 | 1179 | * external script or style; acceptable values are "text/css" and |
1180 | 1180 | * "text/javascript"; if no type is provided, text/javascript is assumed. |
1181 | | - * @param blocking {Boolean} (optional) If true, load modules in a blocking |
1182 | | - * fashion if document ready has not yet occurred |
| 1181 | + * @param async {Boolean} (optional) If true, load modules asynchronously |
| 1182 | + * even if document ready has not yet occurred. If false (default), |
| 1183 | + * block before document ready and load async after |
1183 | 1184 | */ |
1184 | | - load: function ( modules, type, blocking ) { |
| 1185 | + load: function ( modules, type, async ) { |
1185 | 1186 | var filtered, m; |
1186 | 1187 | |
1187 | 1188 | // Validate input |
— | — | @@ -1199,7 +1200,7 @@ |
1200 | 1201 | } ) ); |
1201 | 1202 | return; |
1202 | 1203 | } else if ( type === 'text/javascript' || type === undefined ) { |
1203 | | - addScript( modules, null, blocking ); |
| 1204 | + addScript( modules, null, async ); |
1204 | 1205 | return; |
1205 | 1206 | } |
1206 | 1207 | // Unknown type |
— | — | @@ -1232,7 +1233,7 @@ |
1233 | 1234 | } |
1234 | 1235 | // Since some modules are not yet ready, queue up a request |
1235 | 1236 | else { |
1236 | | - request( filtered, null, null, blocking ); |
| 1237 | + request( filtered, null, null, async ); |
1237 | 1238 | return; |
1238 | 1239 | } |
1239 | 1240 | }, |
Property changes on: branches/REL1_19/phase3 |
___________________________________________________________________ |
Modified: svn:mergeinfo |
1240 | 1241 | Merged /trunk/phase3:r111478,111571,111574,111597,111658 |