* Spit the generated LocalSettings code out during the installer as an aid
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 16 Jan 2006 10:16:06 +0000 (10:16 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 16 Jan 2006 10:16:06 +0000 (10:16 +0000)
  to debugging issues. (Keep this?)
* Use __FILE__ to form path in new LocalSettings.php, so it stays accurate
  when the directory is relocated for typical usage.
* Auto-update $wgCacheEpoch when LocalSettings.php changes on new installs.
  For typical usage this will be a light burden and should reduce confusion
  when the configuration is edited.
* Fix $wgCacheEpoch's effect on client-side caching.

RELEASE-NOTES
config/index.php
includes/OutputPage.php

index 58514c3..fb8f36b 100644 (file)
@@ -506,6 +506,15 @@ fully support the editing toolbar, but was found to be too confusing.
   This is displayed instead of the regular sitenotice, if it exists. If not, the
   regular sitenotice shows. If that doesn't exist, the value of $wgSiteNotice is used,
   and if that's null, then nothing is shown.
+* Spit the generated LocalSettings code out during the installer as an aid
+  to debugging issues. (Keep this?)
+* Use __FILE__ to form path in new LocalSettings.php, so it stays accurate
+  when the directory is relocated for typical usage.
+* Auto-update $wgCacheEpoch when LocalSettings.php changes on new installs.
+  For typical usage this will be a light burden and should reduce confusion
+  when the configuration is edited.
+* Fix $wgCacheEpoch's effect on client-side caching.
+
 
 === Caveats ===
 
index af9a98e..0de00c4 100644 (file)
@@ -25,6 +25,7 @@ header( "Content-type: text/html; charset=utf-8" );
 
 # Attempt to set up the include path, to fix problems with relative includes
 $IP = dirname( dirname( __FILE__ ) );
+define( 'MW_INSTALL_PATH', $IP );
 $sep = PATH_SEPARATOR;
 if( !ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ) ) {
        set_include_path( ".$sep$IP$sep$IP/includes$sep$IP/languages" );
@@ -463,6 +464,9 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
 
                /* Load up the settings and get installin' */
                $local = writeLocalSettings( $conf );
+               echo "<p><b>Generating configuration file...</b></p>\n";
+               echo "<pre>" . htmlspecialchars( $local ) . "</pre>\n";
+               
                $wgCommandLineMode = false;
                chdir( ".." );
                eval($local);
@@ -1159,10 +1163,17 @@ function writeLocalSettings( $conf ) {
 # and their default values, but don't forget to make changes in _this_
 # file, not there.
 
-\$IP = \"{$slconf['IP']}\";
-if( !ini_set( \"include_path\", \".$sep\$IP$sep\$IP/includes$sep\$IP/languages\" ) ) {
-       set_include_path( \".$sep\$IP$sep\$IP/includes$sep\$IP/languages\" );
+# 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__ );
 }
+
+\$path = array( \$IP, \"\$IP/includes\", \"\$IP/languages\" );
+set_include_path( implode( PATH_SEPARATOR, \$path ) );
+
 require_once( \"includes/DefaultSettings.php\" );
 
 # If PHP's memory limit is very low, some operations may fail.
@@ -1183,7 +1194,9 @@ if ( \$wgCommandLineMode ) {
 \$wgScript           = \"\$wgScriptPath/index.php\";
 \$wgRedirectScript   = \"\$wgScriptPath/redirect.php\";
 
-## If using PHP as a CGI module, use the ugly URLs
+## For more information on customizing the URLs please see:
+## http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
+## If using PHP as a CGI module, the ?title= style usually must be used.
 {$pretty}\$wgArticlePath      = \"\$wgScript/\$1\";
 {$ugly}\$wgArticlePath      = \"\$wgScript?title=\$1\";
 
@@ -1224,8 +1237,8 @@ if ( \$wgCommandLineMode ) {
 \$wgMemCachedServers = $mcservers;
 
 ## To enable image uploads, make sure the 'images' directory
-## is writable, then uncomment this:
-# \$wgEnableUploads            = true;
+## is writable, then set this to true:
+\$wgEnableUploads              = false;
 \$wgUseImageResize             = {$conf->UseImageResize};
 {$magic}\$wgUseImageMagick = true;
 {$magic}\$wgImageMagickConvertCommand = \"{$convert}\";
@@ -1238,7 +1251,7 @@ if ( \$wgCommandLineMode ) {
 
 ## If you have the appropriate support software installed
 ## you can enable inline LaTeX equations:
-# \$wgUseTeX                   = true;
+\$wgUseTeX              = false;
 \$wgMathPath         = \"{\$wgUploadPath}/math\";
 \$wgMathDirectory    = \"{\$wgUploadDirectory}/math\";
 \$wgTmpDirectory     = \"{\$wgUploadDirectory}/tmp\";
@@ -1251,7 +1264,7 @@ if ( \$wgCommandLineMode ) {
 
 ## Default skin: you can change the default skin. Use the internal symbolic
 ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
-\$wgDefaultSkin = 'monobook';
+\$wgDefaultSkin = 'monobook';
 
 ## For attaching licensing metadata to pages, and displaying an
 ## appropriate copyright notice / icon. GNU Free Documentation
@@ -1264,6 +1277,11 @@ if ( \$wgCommandLineMode ) {
 # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used
 
 \$wgDiff3 = \"{$slconf['diff3']}\";
+
+# When you make changes to this configuration file, this will make
+# sure that cached pages are cleared.
+\$configdate = gmdate( 'YmdHis', @filemtime( __FILE__ ) );
+\$wgCacheEpoch = max( \$wgCacheEpoch, \$configdate );
 ";
        // Keep things in Unix line endings internally;
        // the system will write out as local text type.
index f04bc64..d7c88a4 100644 (file)
@@ -88,7 +88,7 @@ class OutputPage {
         * returns true iff cache-ok headers was sent.
         */
        function checkLastModified ( $timestamp ) {
-               global $wgCachePages, $wgUser;
+               global $wgCachePages, $wgCacheEpoch, $wgUser;
                if ( !$timestamp || $timestamp == '19700101000000' ) {
                        wfDebug( "CACHE DISABLED, NO TIMESTAMP\n" );
                        return;
@@ -103,7 +103,7 @@ class OutputPage {
                }
 
                $timestamp=wfTimestamp(TS_MW,$timestamp);
-               $lastmod = wfTimestamp( TS_RFC2822, max( $timestamp, $wgUser->mTouched ) );
+               $lastmod = wfTimestamp( TS_RFC2822, max( $timestamp, $wgUser->mTouched, $wgCacheEpoch ) );
 
                if( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
                        # IE sends sizes after the date like this:
@@ -114,17 +114,17 @@ class OutputPage {
                        $ismodsince = wfTimestamp( TS_MW, $modsinceTime ? $modsinceTime : 1 );
                        wfDebug( "-- client send If-Modified-Since: " . $modsince . "\n", false );
                        wfDebug( "--  we might send Last-Modified : $lastmod\n", false );
-                       if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) ) {
+                       if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
                                # Make sure you're in a place you can leave when you call us!
                                header( "HTTP/1.0 304 Not Modified" );
                                $this->mLastModified = $lastmod;
                                $this->sendCacheControl();
-                               wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
+                               wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
                                $this->disable();
                                @ob_end_clean(); // Don't output compressed blob
                                return true;
                        } else {
-                               wfDebug( "READY  client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
+                               wfDebug( "READY  client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
                                $this->mLastModified = $lastmod;
                        }
                } else {