| Index: branches/wmf/1.17wmf1/extensions/Narayam/Narayam.php |
| — | — | @@ -204,13 +204,14 @@ |
| 205 | 205 | 'messages' => array( 'narayam-si-wijesekara' ), |
| 206 | 206 | 'dependencies' => 'ext.narayam.core', |
| 207 | 207 | ); |
| 208 | | -$wgResourceModules['ext.narayam.rules.ta99'] = $narayamTpl + array( |
| 209 | | - 'scripts' => 'ext.narayam.rules.ta99.js', |
| 210 | | - 'messages' => array( 'narayam-ta99' ), |
| 211 | | - 'dependencies' => 'ext.narayam.core', |
| 212 | | -); |
| 213 | 208 | $wgResourceModules['ext.narayam.rules.ta'] = $narayamTpl + array( |
| 214 | 209 | 'scripts' => 'ext.narayam.rules.ta.js', |
| 215 | 210 | 'messages' => array( 'narayam-ta' ), |
| 216 | 211 | 'dependencies' => 'ext.narayam.core', |
| 217 | 212 | ); |
| | 213 | +$wgResourceModules['ext.narayam.rules.ta99'] = $narayamTpl + array( |
| | 214 | + 'scripts' => 'ext.narayam.rules.ta99.js', |
| | 215 | + 'messages' => array( 'narayam-ta99' ), |
| | 216 | + 'dependencies' => 'ext.narayam.rules.ta', // make sure ta99 loads after ta |
| | 217 | +); |
| | 218 | + |
| Index: branches/wmf/1.17wmf1/extensions/Collection/Collection.body.php |
| — | — | @@ -948,11 +948,7 @@ |
| 949 | 949 | } |
| 950 | 950 | |
| 951 | 951 | function renderCollection( $collection, $referrer, $writer ) { |
| 952 | | - global $wgOut; |
| 953 | | - global $wgContLang; |
| 954 | | - global $wgServer; |
| 955 | | - global $wgScriptPath; |
| 956 | | - global $wgScriptExtension; |
| | 952 | + global $wgOut, $wgContLang, $wgScriptPath, $wgScriptExtension; |
| 957 | 953 | |
| 958 | 954 | if ( !$writer ) { |
| 959 | 955 | $writer = 'rl'; |
| — | — | @@ -960,7 +956,7 @@ |
| 961 | 957 | |
| 962 | 958 | $response = self::mwServeCommand( 'render', array( |
| 963 | 959 | 'metabook' => $this->buildJSONCollection( $collection ), |
| 964 | | - 'base_url' => $wgServer . $wgScriptPath, |
| | 960 | + 'base_url' => wfExpandUrl( $wgScriptPath ), |
| 965 | 961 | 'script_extension' => $wgScriptExtension, |
| 966 | 962 | 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ), |
| 967 | 963 | 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ), |
| — | — | @@ -986,19 +982,14 @@ |
| 987 | 983 | } |
| 988 | 984 | |
| 989 | 985 | function forceRenderCollection() { |
| 990 | | - global $wgOut; |
| 991 | | - global $wgContLang; |
| 992 | | - global $wgRequest; |
| 993 | | - global $wgServer; |
| 994 | | - global $wgScriptPath; |
| 995 | | - global $wgScriptExtension; |
| | 986 | + global $wgOut, $wgContLang, $wgRequest, $wgScriptPath, $wgScriptExtension; |
| 996 | 987 | |
| 997 | 988 | $collectionID = $wgRequest->getVal( 'collection_id', '' ); |
| 998 | 989 | $writer = $wgRequest->getVal( 'writer', 'rl' ); |
| 999 | 990 | |
| 1000 | 991 | $response = self::mwServeCommand( 'render', array( |
| 1001 | 992 | 'collection_id' => $collectionID, |
| 1002 | | - 'base_url' => $wgServer . $wgScriptPath, |
| | 993 | + 'base_url' => wfExpandUrl( $wgScriptPath ), |
| 1003 | 994 | 'script_extension' => $wgScriptExtension, |
| 1004 | 995 | 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ), |
| 1005 | 996 | 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ), |
| — | — | @@ -1080,7 +1071,7 @@ |
| 1081 | 1072 | $wgOut->setPageTitle( wfMsg( 'coll-rendering_finished_title' ) ); |
| 1082 | 1073 | |
| 1083 | 1074 | $template = new CollectionFinishedTemplate(); |
| 1084 | | - $template->set( 'download_url', $wgServer . SkinTemplate::makeSpecialUrl( 'Book', 'bookcmd=download&' . $query ) ); |
| | 1075 | + $template->set( 'download_url', wfExpandUrl( SkinTemplate::makeSpecialUrl( 'Book', 'bookcmd=download&' . $query ) ) ); |
| 1085 | 1076 | $template->set( 'is_cached', $wgRequest->getVal( 'is_cached' ) ); |
| 1086 | 1077 | $template->set( 'query', $query ); |
| 1087 | 1078 | $template->set( 'return_to', $return_to ); |
| — | — | @@ -1161,10 +1152,7 @@ |
| 1162 | 1153 | } |
| 1163 | 1154 | |
| 1164 | 1155 | function postZIP( $collection, $partner ) { |
| 1165 | | - global $wgServer; |
| 1166 | | - global $wgScriptPath; |
| 1167 | | - global $wgScriptExtension; |
| 1168 | | - global $wgOut; |
| | 1156 | + global $wgScriptPath, $wgScriptExtension, $wgOut; |
| 1169 | 1157 | |
| 1170 | 1158 | if ( !isset( $this->mPODPartners[$partner] ) ) { |
| 1171 | 1159 | $wgOut->showErrorPage( 'coll-invalid_podpartner_title', 'coll-invalid_podpartner_msg' ); |
| — | — | @@ -1173,7 +1161,7 @@ |
| 1174 | 1162 | |
| 1175 | 1163 | $response = self::mwServeCommand( 'zip_post', array( |
| 1176 | 1164 | 'metabook' => $this->buildJSONCollection( $collection ), |
| 1177 | | - 'base_url' => $wgServer . $wgScriptPath, |
| | 1165 | + 'base_url' => wfExpandUrl( $wgScriptPath ), |
| 1178 | 1166 | 'script_extension' => $wgScriptExtension, |
| 1179 | 1167 | 'template_blacklist' => wfMsgForContent( 'coll-template_blacklist_title' ), |
| 1180 | 1168 | 'template_exclusion_category' => wfMsgForContent( 'coll-exclusion_category_title' ), |
| Index: branches/wmf/1.17wmf1/extensions/Collection/Collection.templates.php |
| — | — | @@ -482,11 +482,10 @@ |
| 483 | 483 | |
| 484 | 484 | // needed for Ajax functions |
| 485 | 485 | function getProposalList () { |
| 486 | | - global $wgServer; |
| 487 | | - global $wgScript; |
| | 486 | + global $wgScript, $wgScriptPath; |
| 488 | 487 | |
| 489 | | - $mediapath = $GLOBALS['wgScriptPath'] . '/extensions/Collection/images/'; |
| 490 | | - $baseUrl = $wgServer . $wgScript . "/"; |
| | 488 | + $mediapath = $wgScriptPath . '/extensions/Collection/images/'; |
| | 489 | + $baseUrl = $wgScript . "/"; |
| 491 | 490 | |
| 492 | 491 | $prop = $this->data['proposals']; |
| 493 | 492 | $out = ''; |
| Index: branches/wmf/1.17wmf1/extensions/ArticleFeedback/populateAFRevisions.php |
| — | — | @@ -40,12 +40,11 @@ |
| 41 | 41 | |
| 42 | 42 | $lastRevID = 0; |
| 43 | 43 | $i = 0; |
| 44 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 45 | 44 | $dbw = wfGetDB( DB_MASTER ); |
| 46 | 45 | $this->output( "Reading data from article_feedback ...\n" ); |
| 47 | 46 | while ( true ) { |
| 48 | 47 | // Get the next revision ID |
| 49 | | - $row = $dbr->selectRow( 'article_feedback', array( 'aa_revision', 'aa_page_id' ), |
| | 48 | + $row = $dbw->selectRow( 'article_feedback', array( 'aa_revision', 'aa_page_id' ), |
| 50 | 49 | "aa_revision > $lastRevID", __METHOD__, |
| 51 | 50 | array( 'ORDER BY' => 'aa_revision', 'LIMIT' => 1 ) |
| 52 | 51 | ); |
| — | — | @@ -57,7 +56,7 @@ |
| 58 | 57 | $pageid = intval( $row->aa_page_id ); |
| 59 | 58 | |
| 60 | 59 | // Get all article_feedback rows for this revision |
| 61 | | - $res = $dbr->select( 'article_feedback', |
| | 60 | + $res = $dbw->select( 'article_feedback', |
| 62 | 61 | array( 'aa_rating_id', 'aa_rating_value', 'aa_user_id', 'aa_user_anon_token' ), |
| 63 | 62 | array( 'aa_revision' => $revid ), |
| 64 | 63 | __METHOD__ |
| Index: branches/wmf/1.17wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
| — | — | @@ -37,11 +37,12 @@ |
| 38 | 38 | $this->dieUsage( 'ArticleFeedback is not enabled on this page', 'invalidpage' ); |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | | - $dbr = wfGetDB( DB_SLAVE ); |
| | 41 | + $dbw = wfGetDB( DB_MASTER ); |
| 42 | 42 | |
| 43 | 43 | // Query the latest ratings by this user for this page, |
| 44 | 44 | // possibly for an older revision |
| 45 | | - $res = $dbr->select( |
| | 45 | + // Select from the master to prevent replag-induced bugs |
| | 46 | + $res = $dbw->select( |
| 46 | 47 | 'article_feedback', |
| 47 | 48 | array( 'aa_rating_id', 'aa_rating_value', 'aa_revision' ), |
| 48 | 49 | array( |
| — | — | @@ -454,4 +455,4 @@ |
| 455 | 456 | public function getVersion() { |
| 456 | 457 | return __CLASS__ . ': $Id$'; |
| 457 | 458 | } |
| 458 | | -} |
| \ No newline at end of file |
| | 459 | +} |
| Property changes on: branches/wmf/1.17wmf1/extensions/ArticleFeedback/api/ApiArticleFeedback.php |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 459 | 460 | Merged /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php:r93711,94376,94404,94502,94509 |
| 460 | 461 | Merged /trunk/phase3/extensions/ArticleFeedback/api/ApiArticleFeedback.php:r94346 |
| Index: branches/wmf/1.17wmf1/extensions/SiteMatrix/SiteMatrixApi.php |
| — | — | @@ -46,7 +46,7 @@ |
| 47 | 47 | if ( $matrix->exist( $lang, $site ) ) { |
| 48 | 48 | $url = $matrix->getUrl( $lang, $site ); |
| 49 | 49 | $site_out = array( |
| 50 | | - 'url' => $url, |
| | 50 | + 'url' => wfExpandUrl( $url ), |
| 51 | 51 | 'code' => $site, |
| 52 | 52 | ); |
| 53 | 53 | if( $matrix->isClosed( $lang, $site ) ) { |
| — | — | @@ -68,7 +68,7 @@ |
| 69 | 69 | $url = $matrix->getUrl( $lang, $site ); |
| 70 | 70 | |
| 71 | 71 | $wiki = array(); |
| 72 | | - $wiki['url'] = $url; |
| | 72 | + $wiki['url'] = wfExpandUrl( $url ); |
| 73 | 73 | $wiki['code'] = str_replace( '_', '-', $lang ) . ( $site != 'wiki' ? $site : '' ); |
| 74 | 74 | |
| 75 | 75 | if( $matrix->isPrivate( $lang . $site ) ) { |
| Index: branches/wmf/1.17wmf1/extensions/CodeReview/backend/CodeCommentLinker.php |
| — | — | @@ -28,7 +28,7 @@ |
| 29 | 29 | function link( $text ) { |
| 30 | 30 | # Catch links like http://www.mediawiki.org/wiki/Special:Code/MediaWiki/44245#c829 |
| 31 | 31 | # Ended by space or brackets (like those pesky <br /> tags) |
| 32 | | - $text = preg_replace_callback( '/(^|[^\w[])(' . wfUrlProtocols() . ')(' . Parser::EXT_LINK_URL_CLASS . '+)/', |
| | 32 | + $text = preg_replace_callback( '/(^|[^\w[])(' . wfUrlProtocolsWithoutProtRel() . ')(' . Parser::EXT_LINK_URL_CLASS . '+)/', |
| 33 | 33 | array( $this, 'generalLink' ), $text ); |
| 34 | 34 | $text = preg_replace_callback( '/\br(\d+)\b/', |
| 35 | 35 | array( $this, 'messageRevLink' ), $text ); |
| Index: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
| — | — | @@ -2458,14 +2458,18 @@ |
| 2459 | 2459 | /** |
| 2460 | 2460 | * Returns a regular expression of url protocols |
| 2461 | 2461 | * |
| | 2462 | + * @param $includeProtocolRelative bool If false, remove '//' from the returned protocol list. |
| | 2463 | + * DO NOT USE this directy, use wfUrlProtocolsWithoutProtRel() instead |
| 2462 | 2464 | * @return String |
| 2463 | 2465 | */ |
| 2464 | | -function wfUrlProtocols() { |
| | 2466 | +function wfUrlProtocols( $includeProtocolRelative = true ) { |
| 2465 | 2467 | global $wgUrlProtocols; |
| 2466 | 2468 | |
| 2467 | | - static $retval = null; |
| 2468 | | - if ( !is_null( $retval ) ) { |
| 2469 | | - return $retval; |
| | 2469 | + // Cache return values separately based on $includeProtocolRelative |
| | 2470 | + static $withProtRel = null, $withoutProtRel = null; |
| | 2471 | + $cachedValue = $includeProtocolRelative ? $withProtRel : $withoutProtRel; |
| | 2472 | + if ( !is_null( $cachedValue ) ) { |
| | 2473 | + return $cachedValue; |
| 2470 | 2474 | } |
| 2471 | 2475 | |
| 2472 | 2476 | // Support old-style $wgUrlProtocols strings, for backwards compatibility |
| — | — | @@ -2473,17 +2477,40 @@ |
| 2474 | 2478 | if ( is_array( $wgUrlProtocols ) ) { |
| 2475 | 2479 | $protocols = array(); |
| 2476 | 2480 | foreach ( $wgUrlProtocols as $protocol ) { |
| 2477 | | - $protocols[] = preg_quote( $protocol, '/' ); |
| | 2481 | + // Filter out '//' if !$includeProtocolRelative |
| | 2482 | + if ( $includeProtocolRelative || $protocol !== '//' ) { |
| | 2483 | + $protocols[] = preg_quote( $protocol, '/' ); |
| | 2484 | + } |
| 2478 | 2485 | } |
| 2479 | 2486 | |
| 2480 | 2487 | $retval = implode( '|', $protocols ); |
| 2481 | 2488 | } else { |
| | 2489 | + // Ignore $includeProtocolRelative in this case |
| | 2490 | + // This case exists for pre-1.6 compatibility, and we can safely assume |
| | 2491 | + // that '//' won't appear in a pre-1.6 config because protocol-relative |
| | 2492 | + // URLs weren't supported until 1.18 |
| 2482 | 2493 | $retval = $wgUrlProtocols; |
| 2483 | 2494 | } |
| | 2495 | + |
| | 2496 | + // Cache return value |
| | 2497 | + if ( $includeProtocolRelative ) { |
| | 2498 | + $withProtRel = $retval; |
| | 2499 | + } else { |
| | 2500 | + $withoutProtRel = $retval; |
| | 2501 | + } |
| 2484 | 2502 | return $retval; |
| 2485 | 2503 | } |
| 2486 | 2504 | |
| 2487 | 2505 | /** |
| | 2506 | + * Like wfUrlProtocols(), but excludes '//' from the protocol list. Use this if |
| | 2507 | + * you need a regex that matches all URL protocols but does not match protocol- |
| | 2508 | + * relative URLs |
| | 2509 | + */ |
| | 2510 | +function wfUrlProtocolsWithoutProtRel() { |
| | 2511 | + return wfUrlProtocols( false ); |
| | 2512 | +} |
| | 2513 | + |
| | 2514 | +/** |
| 2488 | 2515 | * Safety wrapper around ini_get() for boolean settings. |
| 2489 | 2516 | * The values returned from ini_get() are pre-normalized for settings |
| 2490 | 2517 | * set via php.ini or php_flag/php_admin_flag... but *not* |
| Property changes on: branches/wmf/1.17wmf1/includes/GlobalFunctions.php |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 2491 | 2518 | Merged /trunk/phase3/includes/GlobalFunctions.php:r94502,94511 |
| Index: branches/wmf/1.17wmf1/includes/parser/Parser.php |
| — | — | @@ -1045,7 +1045,7 @@ |
| 1046 | 1046 | */ |
| 1047 | 1047 | function doMagicLinks( $text ) { |
| 1048 | 1048 | wfProfileIn( __METHOD__ ); |
| 1049 | | - $prots = $this->mUrlProtocols; |
| | 1049 | + $prots = wfUrlProtocolsWithoutProtRel(); |
| 1050 | 1050 | $urlChar = self::EXT_LINK_URL_CLASS; |
| 1051 | 1051 | $text = preg_replace_callback( |
| 1052 | 1052 | '!(?: # Start cases |
| — | — | @@ -1701,7 +1701,7 @@ |
| 1702 | 1702 | # Don't allow internal links to pages containing |
| 1703 | 1703 | # PROTO: where PROTO is a valid URL protocol; these |
| 1704 | 1704 | # should be external links. |
| 1705 | | - if ( preg_match( '/^\b(?:' . wfUrlProtocols() . ')/', $m[1] ) ) { |
| | 1705 | + if ( preg_match( '/^(?:' . wfUrlProtocols() . ')/', $m[1] ) ) { |
| 1706 | 1706 | $s .= $prefix . '[[' . $line ; |
| 1707 | 1707 | wfProfileOut( __METHOD__."-misc" ); |
| 1708 | 1708 | continue; |
| Property changes on: branches/wmf/1.17wmf1/includes/parser/Parser.php |
| ___________________________________________________________________ |
| Modified: svn:mergeinfo |
| 1709 | 1709 | Merged /trunk/phase3/includes/parser/Parser.php:r94346,94502 |
| Index: branches/wmf/1.17wmf1/includes/api/ApiFormatBase.php |
| — | — | @@ -265,7 +265,7 @@ |
| 266 | 266 | // encode all comments or tags as safe blue strings |
| 267 | 267 | $text = preg_replace( '/\<(!--.*?--|.*?)\>/', '<span style="color:blue;"><\1></span>', $text ); |
| 268 | 268 | // identify URLs |
| 269 | | - $protos = wfUrlProtocols(); |
| | 269 | + $protos = wfUrlProtocolsWithoutProtRel(); |
| 270 | 270 | // This regex hacks around bug 13218 (" included in the URL) |
| 271 | 271 | $text = preg_replace( "#(($protos).*?)(")?([ \\'\"<>\n]|<|>|")#", '<a href="\\1">\\1</a>\\3\\4', $text ); |
| 272 | 272 | // identify requests to api.php |
| Property changes on: branches/wmf/1.17wmf1/includes/api/ApiFormatBase.php |
| ___________________________________________________________________ |
| Added: svn:mergeinfo |
| 273 | 273 | Merged /branches/REL1_15/phase3/includes/api/ApiFormatBase.php:r51646 |
| 274 | 274 | Merged /branches/REL1_16/phase3/includes/api/ApiFormatBase.php:r63621-63636,69357 |
| 275 | 275 | Merged /branches/wmf/1.16wmf4/includes/api/ApiFormatBase.php:r67177,69199,69521,76243,77266 |
| 276 | 276 | Merged /branches/sqlite/includes/api/ApiFormatBase.php:r58211-58321 |
| 277 | 277 | Merged /trunk/phase3/includes/api/ApiFormatBase.php:r89512-89513,89549,89574,94502 |
| 278 | 278 | Merged /branches/wmf-deployment/includes/api/ApiFormatBase.php:r53381,59952,60970 |