[Home]ConfigOnlyInstall

UseModWiki | RecentChanges | Preferences

Description

This is a fix so that only the config file needs to be edited. It would have been nice to have them all be able to drop straight into the cgi-bin and have no directory structure, but on my hosts Apache server this was not possible.

The idea is to deliver a starter pack that points more easily as to what to alter.

  1. Take the files:
    1. cgi-bin/wiki.pl
    2. cgi-bin/Diff.pm
    3. cgi-bin/wiki.conf
    4. wiki/wiki.css
    5. wiki/wiki.gif
    6. wiki/db/*
    7. wiki/upload/*
  2. Copy them all to the server
  3. Modify the .conf, .css, and .gif to your preferences.

This allows several wikis to run in one cgi-bin just be copying the wiki.pl and the wiki.conf to another pair with the same base name. EG funwiki.pl and funwiki.conf.

--MarkButler


Comments

This is an interesting idea. One possible problem is the $LogoUrl setting: it is used as the URL in an IMG tag, so "./wiki.gif" doesn't seem right (The output HTML would be like <img src="./wiki.gif" ...>.) I think it should just be "wiki.gif" if it uses the same cgi-bin directory. (Of course, most browsers will probably do the right thing anyway.)

Fair enough. I just do this now days from a faint memory of some compatibility issues I had in the passed. I will change to this. --MarkButler

One thing that you could do with this change is to set the $DataDir to "./wikidb", and distribute it with a set of starter pages all in one .zip/.tgz file. (You could extract the archive in your cgi-bin directory.)

This is an excellant idea and I will do this as well. I was trying to keep it out of there due to some feeling this is not nice to have in the cgi-bin, but I have already proposed the other items to be in there and it is really only for a starter kit. Given this is a script runable area, could there be security issues with wiki.pl begin forced to make scripts that are then run? --MarkButler

Hmmm... It's conceivable that a person could make a script runnable in the temp subdirectory (by creating a page which contains the script--the diff functions would write it out to a file under temp). It would not be executable (in the chmod sense), but some configurations don't care about that. You could make it harder by adding a .htaccess file in the ./wikidb directory which turns off the CGI-executing ability. (I don't remember the command offhand.) Most users with publically-accessible wikis are running under Apache, so this would work for most people. People who are still concerned could always change the $DataDir setting. --CliffordAdams

I'm considering making something like this an option in 1.1, if I have time after fixing the reported bugs. (The setDirNames? function is a good idea--a couple times I have changed the $DataDir in the config file (for special testing), and then I had to copy all the other directory-setting code. --CliffordAdams

Remember I am newbie at this and most of these come from cwick, but I cant seem to contact him. --MarkButler


I just realized that this kind of configuration would also allow one to write a web-based configuration editor, which would remove the need for any manual editing. A long time ago I wanted to do this, but the need to set the $DataDir was a big problem. (I was also concerned about a few rare webservers that don't set the current directory to the cgi-bin directory when executing, but this no longer seems like a big issue.) Unfortunately, I don't have nearly enough time to do this, but it would be a wonderful feature for another distribution. --CliffordAdams


Having the Admin password in the conf file in the cgi-bin directory is a little sketchy. If you do this, you might want to add the following to your cgi directory in httpd.conf:
   <Files ~ "\.conf$">
        Order allow,deny
        Deny from all
   </Files>
...DougConley

The Mod

--- wiki.1.0.0.pl	Thu Sep 12 10:53:14 2002
+++ wikipatch.ConfigOnlyInstall.pl	Mon Jan 19 23:05:48 2004
@@ -1,3 +1,4 @@
+#!/usr/bin/perl
 #!perl
 # UseModWiki version 1.0 (September 12, 2003)
 # Copyright (C) 2000-2003 Clifford A. Adams  <caadams@usemod.com>
@@ -67,7 +68,7 @@
 # == Configuration =====================================================
 $DataDir     = "C:/wikidb"; # Main wiki directory
 $UseConfig   = 1;       # 1 = use config file,    0 = do not look for config
-$ConfigFile  = "$DataDir/config";   # Configuration file
+$ConfigFile  = "wiki.conf";     # Configuration file
 
 # Default configuration (used if UseConfig is 0)
 $CookieName  = "Wiki";          # Name for this wiki (for multi-wiki sites)
@@ -197,17 +198,19 @@
 
 # == You should not have to change anything below this line. =============
 $IndentLimit = 20;                  # Maximum depth of nested lists
-$PageDir     = "$DataDir/page";     # Stores page data
-$HtmlDir     = "$DataDir/html";     # Stores HTML versions
-$UserDir     = "$DataDir/user";     # Stores user data
-$KeepDir     = "$DataDir/keep";     # Stores kept (old) page data
-$TempDir     = "$DataDir/temp";     # Temporary files and locks
-$LockDir     = "$TempDir/lock";     # DB is locked if this exists
-$InterFile   = "$DataDir/intermap"; # Interwiki site->url map
-$RcFile      = "$DataDir/rclog";    # New RecentChanges logfile
-$RcOldFile   = "$DataDir/oldrclog"; # Old RecentChanges logfile
-$IndexFile   = "$DataDir/pageidx";  # List of all pages
-$EmailFile   = "$DataDir/emails";   # Email notification lists
+sub setDirNames {
+  $PageDir     = "$DataDir/page";     # Stores page data
+  $HtmlDir     = "$DataDir/html";     # Stores HTML versions
+  $UserDir     = "$DataDir/user";     # Stores user data
+  $KeepDir     = "$DataDir/keep";     # Stores kept (old) page data
+  $TempDir     = "$DataDir/temp";     # Temporary files and locks
+  $LockDir     = "$TempDir/lock";     # DB is locked if this exists
+  $InterFile   = "$DataDir/intermap"; # Interwiki site->url map
+  $RcFile      = "$DataDir/rclog";    # New RecentChanges logfile
+  $RcOldFile   = "$DataDir/oldrclog"; # Old RecentChanges logfile
+  $IndexFile   = "$DataDir/pageidx";  # List of all pages
+  $EmailFile   = "$DataDir/emails";   # Email notification lists
+}
 
 if ($RepInterMap) {
   push @ReplaceableFiles, $InterFile;
@@ -215,6 +218,12 @@
 
 # The "main" program, called at the end of this script file.
 sub DoWikiRequest {
+  &setDirNames();
+  my @Path = split('/', "$ENV{SCRIPT_NAME}");
+  my ($Name) = split('\.pl', pop(@Path));
+  if (-f $Name.'.conf') {
+    $ConfigFile = $Name.'.conf';
+  }
   if ($UseConfig && (-f $ConfigFile)) {
     $ConfigError = '';
     if (!do $ConfigFile) {   # Some error occurred
@@ -228,6 +237,7 @@
 #       $ConfigError = T('Unknown Error (no error text)');
       }
     }
+    &setDirNames();
   }
   &InitLinkPatterns();
   if (!&DoCacheBrowse()) {

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