r77779 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77778‎ | r77779 | r77780 >
Date:06:43, 5 December 2010
Author:dantman
Status:ok (Comments)
Tags:
Comment:
Add MW_CONFIG_FILE support to load a separate config file instead of LocalSettings.php, similar functionality to MW_CONFIG_CALLBACK but works in some cases that it doesn't.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/WebStart.php (modified) (history)
  • /trunk/phase3/maintenance/Maintenance.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/Maintenance.php
@@ -839,6 +839,8 @@
840840 $wgWikiFarm = false;
841841 if ( isset( $this->mOptions['conf'] ) ) {
842842 $settingsFile = $this->mOptions['conf'];
 843+ } else if ( defined("MW_CONFIG_FILE") ) {
 844+ $settingsFile = MW_CONFIG_FILE;
843845 } else {
844846 $settingsFile = "$IP/LocalSettings.php";
845847 }
Index: trunk/phase3/includes/WebStart.php
@@ -103,17 +103,20 @@
104104 }
105105 call_user_func( $callback );
106106 } else {
107 - # LocalSettings.php is the per site customization file. If it does not exit
108 - # the wiki installer need to be launched or the generated file moved from
 107+ if ( !defined('MW_CONFIG_FILE') )
 108+ define('MW_CONFIG_FILE', "$IP/LocalSettings.php");
 109+
 110+ # LocalSettings.php is the per site customization file. If it does not exist
 111+ # the wiki installer needs to be launched or the generated file moved from
109112 # ./config/ to ./
110 - if( !file_exists( "$IP/LocalSettings.php" ) ) {
 113+ if( !file_exists( MW_CONFIG_FILE ) ) {
111114 require_once( "$IP/includes/DefaultSettings.php" ); # used for printing the version
112115 require_once( "$IP/includes/templates/NoLocalSettings.php" );
113116 die();
114117 }
115118
116119 # Include site settings. $IP may be changed (hopefully before the AutoLoader is invoked)
117 - require_once( "$IP/LocalSettings.php" );
 120+ require_once( MW_CONFIG_FILE );
118121 }
119122
120123 if ( $wgEnableSelenium ) {
Index: trunk/phase3/RELEASE-NOTES
@@ -87,6 +87,9 @@
8888 * (bug 25728) Added $wgPasswordSenderName to allow customise the name associed
8989 with $wgPasswordSender
9090 * Sysops now have the "suppressredirect" right by default
 91+* Special wrapping setups can now define MW_CONFIG_FILE to load a config file
 92+ other than LocalSettings.php. This is like MW_CONFIG_CALLBACK but works in
 93+ some cases where MW_CONFIG_CALLBACK will not work.
9194
9295 === New features in 1.17 ===
9396 * (bug 10183) Users can now add personal styles and scripts to all skins via

Follow-up revisions

RevisionCommit summaryAuthorDate
r77780Followup r77779, release note was put in the wrong section.dantman06:46, 5 December 2010

Comments

#Comment by Nikerabbit (talk | contribs)   09:52, 5 December 2010

Those "some cases" should be documented somewhere. Otherwise it is hard to asses whether this commit is good or not.

#Comment by Dantman (talk | contribs)   09:59, 5 December 2010

Oh, "some cases" as in MW_CONFIG_CALLBACK is a callback, because it has to be a function things like extensions can't be setup if you try to wrap MediaWiki and use MW_CONFIG_CALLBACK. So MW_CONFIG_CALLBACK has restricted usefulness, MW_CONFIG_FILE will let a wrapper have a little more control over it. (Namely the ability to wrap MediaWiki hopefully without having to make any core modifications at all and be able to upgrade in the future without having to re-apply code changes and whatnot). I ran into the issue when I was trying to create a special type of wiki farm.

Status & tagging log