[Home]WikiPatches/MoveConfigFile

UseModWiki | WikiPatches | RecentChanges | Preferences

I have added the $ConfigFile? variable to 1.0. (For the final release I decided to place it slightly below $DataDir.) --CliffordAdams


I wanted to have the config file in a directory that is not in the wiki base directory for security reasons. It is easily done with this patch:
--- wiki.pl     Sun Apr 22 02:44:10 2001
+++ ../usemod092-patched/wiki.pl        Sat Oct 20 18:26:24 2001
@@ -38,7 +38,7 @@
   $UseSubpage $UseCache $RawHtml $SimpleLinks $NonEnglish $LogoLeft
   $KeepDays $HtmlTags $HtmlLinks $UseDiffLog $KeepMajor $KeepAuthor
   $FreeUpper $EmailNotify $SendMail $EmailFrom $FastGlob $EmbedWiki
-  $ScriptTZ $BracketText $UseAmPm $UseConfig $UseIndex $UseLookup
+  $ScriptTZ $BracketText $UseAmPm $ConfigFile $UseIndex $UseLookup
   $RedirType $AdminPass $EditPass $UseHeadings $NetworkFile $BracketWiki
   $FreeLinks $WikiLinks $AdminDelete $FreeLinkPattern $RCName $RunCGI
   $ShowEdits $ThinLine $LinkPattern $InterLinkPattern $InterSitePattern
@@ -55,10 +55,16 @@
   $q $Now $UserID $TimeZoneOffset $ScriptName $BrowseCode $OtherCode);
 # == Configuration =====================================================
-$DataDir     = "/tmp/mywikidb"; # Main wiki directory
-$UseConfig   = 1;       # 1 = use config file,    0 = do not look for config
+# twm: changed this to contain the name of the config file rather than
+# having only a boolean variable UseConfig.
+# Of course this required a few changes later on, but only a few.
 
-# Default configuration (used if UseConfig is 0)
+$ConfigFile   = "/etc/wiki.conf";       # Name of config file; if "" defaults are used
+
+# Default configuration (used if ConfigFile is "")
+
+#twm: This should also go into the config file
+$DataDir     = "/usr/local/data/webserver/wiki.s2h.cx"; # Main wiki directory
 $CookieName  = "Wiki";          # Name for this wiki (for multi-wiki sites)
 $SiteName    = "Wiki";          # Name of site (used for titles)
 $HomePage    = "HomePage";      # Home page (change space to _)
@@ -145,8 +151,8 @@
 
 # The "main" program, called at the end of this script file.
 sub DoWikiRequest {
-  if ($UseConfig && (-f "$DataDir/config")) {
-    do "$DataDir/config";  # Later consider error checking?
+  if ( ("$ConfigFile") && (-f "$ConfigFile")) {
+    do "$ConfigFile";  # Later consider error checking?
   }
   &InitLinkPatterns();
   if (!&DoCacheBrowse()) {
So you just set $ConfigFile to "/etc/wiki.conf" and put the config file there. -- twm

UseModWiki | WikiPatches | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited July 7, 2007 2:43 am by MarkusLude (diff)
Search: