$bits = wfParseUrl( $url );
// ensure proper port for HTTPS arrives in URL
- // https://bugzilla.wikimedia.org/show_bug.cgi?id=65184
+ // https://phabricator.wikimedia.org/T67184
if ( $defaultProto === PROTO_HTTPS && $wgHttpsPort != 443 ) {
$bits['port'] = $wgHttpsPort;
}
MediaWiki\restoreWarnings();
if ( !$ok ) {
- //directory may have been created on another request since we last checked
+ // directory may have been created on another request since we last checked
if ( is_dir( $dir ) ) {
return true;
}
*
* @see perldoc -f use
*
+ * @deprecated since 1.26, use the "requires' property of extension.json
* @param string|int|float $req_ver The version to check, can be a string, an integer, or a float
* @throws MWException
*/
$_SESSION = $tmp;
}
$newSessionId = session_id();
- Hooks::run( 'ResetSessionID', array( $oldSessionId, $newSessionId ) );
}
/**
* @return bool
*/
function wfIsBadImage( $name, $contextTitle = false, $blacklist = null ) {
- static $badImageCache = null; // based on bad_image_list msg
-
# Handle redirects
$redirectTitle = RepoGroup::singleton()->checkRedirect( Title::makeTitle( NS_FILE, $name ) );
if ( $redirectTitle ) {
return $bad;
}
- $cacheable = ( $blacklist === null );
- if ( $cacheable && $badImageCache !== null ) {
- $badImages = $badImageCache;
- } else { // cache miss
+ $cache = ObjectCache::newAccelerator( 'hash' );
+ $key = wfMemcKey( 'bad-image-list', ( $blacklist === null ) ? 'default' : md5( $blacklist ) );
+ $badImages = $cache->get( $key );
+
+ if ( $badImages === false ) { // cache miss
if ( $blacklist === null ) {
$blacklist = wfMessage( 'bad_image_list' )->inContentLanguage()->plain(); // site list
}
$badImages[$imageDBkey] = $exceptions;
}
}
- if ( $cacheable ) {
- $badImageCache = $badImages;
- }
+ $cache->set( $key, $badImages, 60 );
}
$contextKey = $contextTitle ? $contextTitle->getPrefixedDBkey() : false;
$bad = isset( $badImages[$name] ) && !isset( $badImages[$name][$contextKey] );
+
return $bad;
}