Exposing it in the default LocalSettings.php as I did in r90105 was not a good solution, really the only way to avoid breakage is to just get the protocol from $wgServer whenever you need the protocol.
Fixed $wgCookieSecure so that it will be enabled automatically if the user sets $wgServer to an https URL in LocalSettings.php. Added documentation for other cookie-related globals.
Grep indicates that $wgProto is not used by any extensions. $wgCookieSecure is used, hence the need for the Setup.php patch.
* The spyc library is now no longer included in phase3.
* (bug 28343) Unused preferences contextlines/contextchars have been removed
* $wgSkinExtensionFunctions has been removed. Use $wgExtensionFunctions instead.
+* $wgProto has been removed. You now only need to set $wgServer to change the
+ URL protocol.
=== New features in 1.18 ===
* (bug 8130) Query pages should limit to content namespaces, not just main
* or ".any.subdomain.net"
*/
$wgCookieDomain = '';
+
+
+/**
+ * Set this variable if you want to restrict cookies to a certain path within
+ * the domain specified by $wgCookieDomain.
+ */
$wgCookiePath = '/';
-$wgCookieSecure = ($wgProto == 'https');
+
+/**
+ * Whether the "secure" flag should be set on the cookie. This can be:
+ * - true: Set secure flag
+ * - false: Don't set secure flag
+ * - "detect": Set the secure flag if $wgServer is set to an HTTPS URL
+ */
+$wgCookieSecure = 'detect';
+
+/**
+ * By default, MediaWiki checks if the client supports cookies during the
+ * login process, so that it can display an informative error message if
+ * cookies are disabled. Set this to true if you want to disable this cookie
+ * check.
+ */
$wgDisableCookieCheck = false;
/**
- * Set $wgCookiePrefix to use a custom one. Setting to false sets the default of
- * using the database name.
+ * Cookies generated by MediaWiki have names starting with this prefix. Set it
+ * to a string to use a custom prefix. Setting it to false causes the database
+ * name to be used as a prefix.
*/
$wgCookiePrefix = false;
/**
* Expand a potentially local URL to a fully-qualified URL. Assumes $wgServer
- * and $wgProto are correct.
+ * is correct.
*
* @todo this won't work with current-path-relative URLs
* like "subdir/foo.html", etc.
* @return string Fully-qualified URL
*/
function wfExpandUrl( $url ) {
+ global $wgServer;
if( substr( $url, 0, 2 ) == '//' ) {
- global $wgProto;
- return $wgProto . ':' . $url;
+ $bits = wfParseUrl( $wgServer );
+ $scheme = $bits ? $bits['scheme'] : 'http';
+ return $scheme . ':' . $url;
} elseif( substr( $url, 0, 1 ) == '/' ) {
- global $wgServer;
return $wgServer . $url;
} else {
return $url;
$wgLogActions['newusers/autocreate'] = 'newuserlog-autocreate-entry';
}
+if ( $wgCookieSecure === 'detect' ) {
+ $wgCookieSecure = ( substr( $wgServer, 0, 6 ) === 'https:' );
+}
+
if ( !defined( 'MW_COMPILED' ) ) {
if ( !MWInit::classExists( 'AutoLoader' ) ) {
require_once( "$IP/includes/AutoLoader.php" );
'active' => $title->isSpecial( 'Userlogin' ) && $is_signup
);
}
- global $wgProto, $wgSecureLogin;
- if( $wgProto === 'http' && $wgSecureLogin ) {
+ global $wgServer, $wgSecureLogin;
+ if( substr( $wgServer, 0, 5 ) === 'http:' && $wgSecureLogin ) {
$title = SpecialPage::getTitleFor( 'Userlogin' );
$https_url = preg_replace( '/^http:/', 'https:', $title->getFullURL() );
$login_url['href'] = $https_url;
'wgImageMagickConvertCommand',
'IP',
'wgServer',
- 'wgProto',
'wgScriptPath',
'wgScriptExtension',
'wgMetaNamespace',
$server = $proto . '://' . IP::combineHostAndPort( $host, $port, $stdPort );
$this->showMessage( 'config-using-server', $server );
$this->setVar( 'wgServer', $server );
- $this->setVar( 'wgProto', $proto );
}
/**
$confItems = array_merge(
array(
- 'wgServer', 'wgProto', 'wgScriptPath', 'wgScriptExtension',
+ 'wgServer', 'wgScriptPath', 'wgScriptExtension',
'wgPasswordSender', 'wgImageMagickConvertCommand', 'wgShellLocale',
'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3',
'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication',
\$wgScriptPath = \"{$this->values['wgScriptPath']}\";
\$wgScriptExtension = \"{$this->values['wgScriptExtension']}\";
-## The server name to use in fully-qualified URLs
+## The protocol and server name to use in fully-qualified URLs
\$wgServer = \"{$this->values['wgServer']}\";
-## The URL protocol, may be http or https
-\$wgProto = \"{$this->values['wgProto']}\";
-
## The relative URL path to the skins directory
\$wgStylePath = \"\$wgScriptPath/skins\";
$wgArticlePath, $wgScriptPath, $wgServer, $wgContLang,
$wgVariantArticlePath, $wgActionPaths, $wgUseAjax, $wgVersion,
$wgEnableAPI, $wgEnableWriteAPI, $wgDBname, $wgEnableMWSuggest,
- $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath, $wgProto,
+ $wgSitename, $wgFileExtensions, $wgExtensionAssetsPath,
$wgCookiePrefix, $wgResourceLoaderMaxQueryLength, $wgLegacyJavaScriptGlobals;
// Pre-process information
$namespaceIds[$wgContLang->lc( $name )] = $index;
}
+ $serverBits = wfParseUrl( $wgServer );
+ $protocol = $serverBits ? $serverBits['scheme'] : 'http';
+
// Build list of variables
$vars = array(
'wgLoadScript' => $wgLoadScript,
'wgFileCanRotate' => BitmapHandler::canRotate(),
'wgAvailableSkins' => Skin::getSkinNames(),
'wgExtensionAssetsPath' => $wgExtensionAssetsPath,
- 'wgProto' => $wgProto,
+ 'wgProto' => $protocol,
// MediaWiki sets cookies to have this prefix by default
'wgCookiePrefix' => $wgCookiePrefix,
'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength,