dépôts
/
lhc
/
web
/
wiklou.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
fc6dcf8
)
Followup r94502: per CR, use two caching variables instead of an array indexed with...
author
Roan Kattouw
<catrope@users.mediawiki.org>
Mon, 15 Aug 2011 13:16:10 +0000
(13:16 +0000)
committer
Roan Kattouw
<catrope@users.mediawiki.org>
Mon, 15 Aug 2011 13:16:10 +0000
(13:16 +0000)
includes/GlobalFunctions.php
patch
|
blob
|
history
diff --git
a/includes/GlobalFunctions.php
b/includes/GlobalFunctions.php
index
68d6865
..
8e3e07c
100644
(file)
--- a/
includes/GlobalFunctions.php
+++ b/
includes/GlobalFunctions.php
@@
-477,9
+477,10
@@
function wfUrlProtocols( $includeProtocolRelative = true ) {
global $wgUrlProtocols;
// Cache return values separately based on $includeProtocolRelative
global $wgUrlProtocols;
// Cache return values separately based on $includeProtocolRelative
- static $retval = array( true => null, false => null );
- if ( !is_null( $retval[$includeProtocolRelative] ) ) {
- return $retval[$includeProtocolRelative];
+ static $withProtRel = null, $withoutProtRel = null;
+ $cachedValue = $includeProtocolRelative ? $withProtRel : $withoutProtRel;
+ if ( !is_null( $cachedValue ) ) {
+ return $cachedValue;
}
// Support old-style $wgUrlProtocols strings, for backwards compatibility
}
// Support old-style $wgUrlProtocols strings, for backwards compatibility
@@
-493,15
+494,22
@@
function wfUrlProtocols( $includeProtocolRelative = true ) {
}
}
}
}
- $retval
[$includeProtocolRelative]
= implode( '|', $protocols );
+ $retval = implode( '|', $protocols );
} else {
// Ignore $includeProtocolRelative in this case
// This case exists for pre-1.6 compatibility, and we can safely assume
// that '//' won't appear in a pre-1.6 config because protocol-relative
// URLs weren't supported until 1.18
} else {
// Ignore $includeProtocolRelative in this case
// This case exists for pre-1.6 compatibility, and we can safely assume
// that '//' won't appear in a pre-1.6 config because protocol-relative
// URLs weren't supported until 1.18
- $retval
[$includeProtocolRelative]
= $wgUrlProtocols;
+ $retval = $wgUrlProtocols;
}
}
- return $retval[$includeProtocolRelative];
+
+ // Cache return value
+ if ( $includeProtocolRelative ) {
+ $withProtRel = $retval;
+ } else {
+ $withoutProtRel = $retval;
+ }
+ return $retval;
}
/**
}
/**