* Don't set $IP. The entry point already sets it, so there's no point. Users can still set it if they can figure out a way to do it without breaking things.
* Don't include DefaultSettings.php. Doing that is code, not configuration, and it can easily be done in WebStart/Maintenance. Some non-standard entry points in extensions may be broken by this. That's their fault for being non-standard. Backwards compatibility is preserved thanks to require_once().
* Introduce $wgInvalidateCacheOnLocalSettingsChange, which when set, causes $wgCacheEpoch to be updated in the way that it previously was in the default LocalSettings.php.
* Don't set $wgLocalInterwiki to some nonsense value (possibly including spaces and punctuation in the new installer). It should be only for actual interwiki prefixes. Since most wikis don't have them, I set this to false by default and adjusted the referring code to accept this.
* Removed the guard for web invocation with $wgCommandLineMode set. This ancient code is redundant with modern protections in doMaintenance.php.
* In DefaultSettings.php, fixed fold terminator placement near $wgLoadScript
* Add a web entry point guard. That's one piece of code which really is necessary.
the footers of skins.
* $wgFileCacheDepth can be used to set the depth of the subdirectory hierarchy
used for the file cache. Default value is 2, which matches former behavior
+* It's no longer necessary for LocalSettings.php to include DefaultSettings.php.
+* It's no longer necessary to set $wgCacheEpoch to the file modification time
+ of LocalSettings.php, in LocalSettings.php itself. Instead, this is done
+ automatically if $wgInvalidateCacheOnLocalSettingsChange is true (which is
+ the default).
=== New features in 1.17 ===
* (bug 10183) Users can now add personal styles and scripts to all skins via
die( 1 );
}
-
# Create a site configuration object. Not used for much in a default install
if ( !defined( 'MW_PHP4' ) ) {
require_once( "$IP/includes/SiteConfiguration.php" );
* Defaults to "{$wgScriptPath}/redirect{$wgScriptExtension}".
*/
$wgRedirectScript = false; ///< defaults to
-/**@}*/
/**
* The URL path to load.php.
*/
$wgLoadScript = false;
+/**@}*/
+
/************************************************************************//**
* @name URLs and file paths
*
*/
$wgClockSkewFudge = 5;
+/**
+ * Invalidate various caches when LocalSettings.php changes. This is equivalent
+ * to setting $wgCacheEpoch to the modification time of LocalSettings.php, as
+ * was previously done in the default LocalSettings.php file.
+ *
+ * On high-traffic wikis, this should be set to false, to avoid the need to
+ * check the file modification time, and to avoid the performance impact of
+ * unnecessary cache invalidations.
+ */
+$wgInvalidateCacheOnLocalSettingsChange = true;
+
/** @} */ # end of cache settings
/************************************************************************//**
*/
$wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";
-$wgLocalInterwiki = 'w';
-$wgInterwikiExpiry = 10800; # Expiry time for cache of interwiki table
+/**
+ * The interwiki prefix of the current wiki, or false if it doesn't have one.
+ */
+$wgLocalInterwiki = false;
+
+/**
+ * Expiry time for cache of interwiki table
+ */
+$wgInterwikiExpiry = 10800;
/** Interwiki caching settings.
$wgInterwikiCache specifies path to constant database file
$flag .= ($rc_new ? "N" : "") . ($rc_minor ? "M" : "") . ($rc_bot ? "B" : "");
}
- if ( $wgRC2UDPInterwikiPrefix === true ) {
+ if ( $wgRC2UDPInterwikiPrefix === true && $wgLocalInterwiki !== false ) {
$prefix = $wgLocalInterwiki;
} elseif ( $wgRC2UDPInterwikiPrefix ) {
$prefix = $wgRC2UDPInterwikiPrefix;
else $wgHtml5Version = 'HTML+RDFa 1.0';
}
+if ( $wgInvalidateCacheOnLocalSettingsChange ) {
+ $wgCacheEpoch = max( $wgCacheEpoch, gmdate( 'YmdHis', @filemtime( "$IP/LocalSettings.php" ) ) );
+}
wfProfileOut( $fname.'-misc1' );
wfProfileIn( $fname.'-memcached' );
$this->mInterwiki = $wgContLang->lc( $p );
# Redundant interwiki prefix to the local wiki
- if ( 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) {
+ if ( $wgLocalInterwiki !== false
+ && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) )
+ {
if ( $dbkey == '' ) {
# Can't have an empty self-link
return false;
# Start the autoloader, so that extensions can derive classes from core files
require_once( "$IP/includes/AutoLoader.php" );
+# Load default settings
+require_once( "$IP/includes/DefaultSettings.php" );
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
# Use a callback function to configure MediaWiki
- require_once( "$IP/includes/DefaultSettings.php" );
-
$callback = MW_CONFIG_CALLBACK;
# PHP 5.1 doesn't support "class::method" for call_user_func, so split it
if ( strpos( $callback, '::' ) !== false ) {
# the wiki installer needs to be launched or the generated file moved from
# ./config/ to ./
if( !file_exists( MW_CONFIG_FILE ) ) {
- require_once( "$IP/includes/DefaultSettings.php" ); # used for printing the version
require_once( "$IP/includes/templates/NoLocalSettings.php" );
die();
}
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings
-# If you customize your file layout, set \$IP to the directory that contains
-# the other MediaWiki files. It will be used as a base to locate files.
-if( defined( 'MW_INSTALL_PATH' ) ) {
- \$IP = MW_INSTALL_PATH;
-} else {
- \$IP = dirname( __FILE__ );
+# Protect against web entry
+if ( !defined( 'MEDIAWIKI' ) ) {
+ exit;
}
-require_once( \"\$IP/includes/DefaultSettings.php\" );
-
-if ( \$wgCommandLineMode ) {
- if ( isset( \$_SERVER ) && array_key_exists( 'REQUEST_METHOD', \$_SERVER ) ) {
- die( \"This script must be run from the command line\\n\" );
- }
-}
## Uncomment this to disable output compression
# \$wgDisableOutputCompression = true;
## be publically accessible from the web.
#\$wgCacheDirectory = \"\$IP/cache\";
-\$wgLocalInterwiki = strtolower( \$wgSitename );
-
# Site language code, should be one of ./languages/Language(.*).php
\$wgLanguageCode = \"{$this->values['wgLanguageCode']}\";
# Path to the GNU diff3 utility. Used for conflict resolution.
\$wgDiff3 = \"{$this->values['wgDiff3']}\";
-# When you make changes to this configuration file, this will make
-# sure that cached pages are cleared.
-\$wgCacheEpoch = max( \$wgCacheEpoch, gmdate( 'YmdHis', @filemtime( __FILE__ ) ) );
-
# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
";
// Some other requires
require_once( "$IP/includes/AutoLoader.php" );
require_once( "$IP/includes/Defines.php" );
+require_once( "$IP/includes/DefaultSettings.php" );
if ( defined( 'MW_CONFIG_CALLBACK' ) ) {
# Use a callback function to configure MediaWiki
- require_once( "$IP/includes/DefaultSettings.php" );
-
$callback = MW_CONFIG_CALLBACK;
# PHP 5.1 doesn't support "class::method" for call_user_func, so split it
if ( strpos( $callback, '::' ) !== false ) {