UseModWiki | UseModWiki | RecentChanges | Preferences

See also /Documentation - /UseModFAQ
The purpose of this page is to allow those of us who would like to help CliffordAdams with the development to ask questions, write tutorials, etc.

Bug reports should be reported in WikiBugs and formal patches announced/published in WikiPatches.

1. What is the format of the data files? Can it be easily understood?

For complete documentation, see DataBase.

Under the data directory are files (page/A/Alkali_model.db, for example).

These files are mostly simple text files. You can cat them to your terminal. The files are delimited by the superscript 3 character, mostly.

The fields in the file are... The first line represents??? There is some diff looking stuff in there???

The datafiles are essentially Perl hash-table structures separated by the $FS[123] characters. They consist of name/value pairs that are not necessarily in any order. A few of the pairs are "cache" values, like the most recent major, minor, and author diffs. The main page data is stored in a "section" structure. See [1] for an old document on the section design that is still mostly accurate. --CliffordAdams

Which file do I read to get the latest full text? I have a wiki-compatible quiz-text format that gets parsed by my home-brewed Perl script and converted to an HTML page as multiple-choice questions in a form. I would like the quiz-source to live in a wiki page, for collaborative editing and proofing, and be called right from the wiki file for parsing and presenting. I can't figure which file to go after, or which chunk of that file to grab. --JerryMuelver

All the current page data is stored in the .db file. You should be able to do something like:

  $FS  = "\xb3";      # The FS character is a superscript "3"
  $FS1 = $FS . "1";   # The FS values are used to separate fields
  $FS2 = $FS . "2";   # in stored hashtables and other data structures.
  $FS3 = $FS . "3";   # The FS character is not allowed in user data.
  # read full contents of .db file into $dbfile
  %Page = split(/$FS1/, $dbfile, -1);
  %Section = split(/$FS2/, $Page{'text_default'}, -1);
  %Text = split(/$FS3/, $Section{'data'}, -1);
  $pagetext = $Text{'text'};   # text of the page

UseModAccess contains sample code to use UseMod internal Functions for this --TobiasWeber?

Thanks, Cliff. Precisely as I hoped. Not too far in the future, people will be saying, "Remember BTW -- Before The Wiki -- when MS Office was so popular?" -- JerryMuelver

Surveying wiki engines for my own small project, UseMod looks very much to my tastes except for the database's Perl hash page storage format. It's important for me to be able to edit the pages as plain wikitext files offline with a text editor from a shell on my web server, without going through wiki.cgi. Anyone know of an engine, especially a UseMod-like one, that stores wiki page contents as simple, unadorned wikitext files? -- DavidMeyer

2. Let's suppose someone with an increasingly high-traffic wiki (WikiPedia, for example) wanted to convert UseModWiki to FastCGI or mod_perl. What would be required?

Not much should be required, as the code was written with mod_perl in mind. For now, sites that want to do this should read the notes on SpeedyCGI and write to usemod@usemod.com for a small patch for cookie handling.

I have posted a patch (see PersistentCGI) to 0.91 for mod_perl Apache::Registry compatibility. --BobShowalter

Revision 0.92 will include code similar to these patches. --CliffordAdams

When using Perl-based systems such as Mason, it's very easy (<10 lines) to embed UseModWiki into a wrapper which will:
See the "Wiki Trad" at http://Trad.org/wiki.html for an example. --LaurentDaverio (DeadLink)

I finally got 0.92 working in mod_perl after being stumped for several days even in the midst of all these tips. I'm assembling a HOWTO at MikeJames. Tweak on it, will you? --Mike

3. Where can I get a basic explanation of what such-and-such a function does?

Try Functions. If you know what a function does, and it doesn't say so over there, please fill it in. There are a lot of functions, but if 10 people do 2-3 a day, we will be done in a few years. *wink*

...Only if I don't code faster than you can document... :-) --CliffordAdams

4. Is there a list of the CGI actions available in the script anywhere (ie pagelock, index and list features, etc)?

See the comprehensive Actions and AdminFeatures, or the more user-friendly System for lists.

See also the subroutines DoBrowseRequest and DoOtherRequest.

5. What thoughts are there on the distribution of the InterWiki tags used in intermap? -- ChrisFedde

Feel free to distribute them. :-) --CliffordAdams

6. Have you anything that describes the basic flow of the wiki.cgi program? -- ChrisFedde

The source code? :-) :-) There really isn't much flow. First the HTML cache is checked (if enabled), then a set of basic/common commands are checked in DoBrowseRequest, and if nothing else handles it, the DoOtherRequest subroutine either does the command or issues an error message. --CliffordAdams

7. PolishTranslation is ready. I only wish I need't have resorted to an ugly hack to translate $RCName. --kpj

Where? Where? Please tell me... I'm planning to install one. --MatthewSimpson

8. What are the diffs between major diffs, minor diffs and author diffs? (Pardon the pun.) :-) -- CAL

Major diffs compare the current revision with the prior major revision (a revision that was not a "minor edit"). Minor diffs compare the current revision with the previous one, regardless of whether the last edit was a major or minor one. Author diffs compare the current revision with the most recent revision by a different author. --CliffordAdams

9. Does anyone know if a patch for creating an edit button on the top of the page and perhaps even change the font of the "Edit" link to a larger font?

I'm thinking that this might increase the chance that people will contribute by editing pages. --MatthewSimpson

You can check UseMod:WikiPatches/EditFromTop. --JuanmaMP

10. What is the backup/restore process for a UseModWiki? Can a UseModWiki be safely and easily moved to a new location on the webserver or to a new server? Can individual pages be imported and exported? -- DavidMasterson

Suppose your wiki is located under /usr/local/www/wiki, simply copy the whole directory and you got yourself a backup. That is the way I do it, I tar.gz the whole thing. To move it to another location, you may need to change a few paths on the config (or script itself, if you're not using the config). It should be a pretty simple task. Cheers! -- DavidCollantes

Actually, unless you are doing something strange, you should only need to back up the $DataDir directory. Moving the wiki is as simple as changing the $DataDir configuration variable. (The wiki data files (except the config file if it is used) do not contain any path information.) --CliffordAdams

I disagree. I backup the whole thing because my wiki is extremely modified, hence it can not be replaced by the vanilla UseMod, and because I use extra .css, .js and images that I do not want to loose in case of a crash and that I will need to "move" the wiki somewhere else. If backing up the $DataDir, why not backup everything else? There is nothing much left to backup, for the people with "normal, vanilla" installations. -- DavidCollantes

I disagree with your disagreement--you're "doing something strange". Consider your warranty voided. :-) --CliffordAdams

I have written a backup script for my wikis and other stuff on distant servers. The script is run as a cronjob. It needs an ssh-account, tar's the wiki directory, uses md5 to decide whether it has changed and downloads the file in my own archive directory at home. You find it at http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?BackupScript. The page is german. If someone is interested and asks, I may translate it. -- ThomasBayen

That works, but somebody has already invented that particular wheel when they wrote [rsync]. That basically does what you're trying to achieve but does it a lot more efficiently. And you can tunnel it over SSH if you want security. For anyone doing any sort of network backup, get rsync (it's standard on most Linux distributions these days). It only sends the bits of a file that have changed, so a minor edit to a large file results in only a small block of data being sent (and that data is compressed before sending). I know - it sounds impossible, but it isn't. I run several web servers and all the client web sites are backed up over the network using rsync, which on sites that don't change much results in a data transfer which is typically less than 1% of the size of the site. --pla

11. As a CGI script, should UseModWiki be doing more to set ownerships and permissions of files? Perhaps it should always set the umask to 0? -- DavidMasterson

I'm mostly thinking of the case where the web server runs CGI scripts as "nobody" which can potentially cause problems for non-root users to move or delete files created by the script. -- DavidMasterson

For cases like this an easy way around the problem is to use a simple wrapper script around the command that you want to execute as "nobody". For example, here is a script (slightly edited) that I use for making backups of the MeatBall wiki. You can just replace the tar command with your own move/delete command. --CliffordAdams

$| = 1;
print "Content-type: text/html\n\n";
print "<html><pre>\n";
print "Output:\n";
print `tar -cvzf /some/private/dir/mbback.tgz /home/usemod/meatball`;
print "\n...done.\n</pre></html>\n";

I'm not sure if this is even what I meant. My problem is not that I want to execute a command as "nobody", but rather that I am not the admin of my webserver and it executes all CGI scripts as "nobody". I have installed UseMod in my own public_html directory, but, because of it running UseMod as "nobody", the directories and files in the $DataDir wind up being owned by "nobody" with a permission that does not allow me to clean them out if (or when) I decide to remove the Wiki. I chose to set the umask to 0 and chmod "g+s" the $DataDir. -- DavidMasterson

Most of the web space providers on Linux (UNIX) offer SuEXEC?, which allows the scripts to run as the owner of the virtual/web space. On those cases there is no need to worry about anything. On extreme cases a chmod 777 will do :-) -- DavidCollantes

Even in most of the extreme cases you don't have to make the wiki data directory itself 777. Instead, you can create a holding directory that is 777 which contains a subdirectory for the data directory. For example, if your account was /home/david then you could create "/home/david/wikidir", do "chmod 777 /home/david/wikidir", then set your $DataDir to "/home/david/wikidir/mywiki" (which will be autocreated by the script). --CliffordAdams

Doesn't solve the problem. Without something like SuEXEC?, all the subdirectories under "mywiki" will wind up being owned by someone else (like "nobody") and you won't be able to admin them (unless you're root). Setting the directory to 777 is also not enough because UseMod sets subdirectories to 555. I modified UseMod to set the umask to 0 and create subdirectories as 775. I also chmod "g+s" the $DataDir to ensure it's my group that things are created with. -- DavidMasterson

You can use this "foo.cgi". When I need to create/edit/delete/whatever files, I just put in the Perl code to do it and lynx it. In this case, I needed to create empty files owned by nobody which I then updated with ReplaceFile? (which requires that the files already exist). You can use 'unlink', 'rmdir', or whatever instead of the code I have here.

    #! /usr/bin/perl -Tw

    print "Content-type: text/html\n\n";

    print "<html><head><title>foo</title></head><body>\n";
    print "I'm foo!\n";
    print "</body></html>\n";

    @files = qw(

    for $f ( @files ) {
        open( FOO, "> $f" );
        print FOO "\n";
        close FOO;
        chmod( 0664, $f );


Replying to the problem posed by DavidMasterson: I did an install of UseModWiki 1.0 in a userspace (/home/user/public_html for purposes of discussion) on a Red Hat Linux server. I was able to keep the wiki's dataspace set drwxrwxr-x, and the file-ownership set to user, by setting the group assignment to nobody (chgrp -R nobody *). That worked, when setting the wiki's subtree world-writable didn't. This being a Red Hat machine, the Apache http server owns user nobody, group nobody. If you're running on some other distributions, they all seem to have different methods, so you'll have to find out what group the httpd demon belongs to there (on MEPIS 3.3.1, apache2 runs as user www-data, for instance). --CrB3 (C. R. Bryan III)

Anyone interested in a modification to the usemod source code that adds an admin bar and an actions bar similar to the navigation bar in the current version (plus options to show or not show in the preferences)? I have written the code and have a working version running at http://www.razar.f2s.com/cgi-bin/newwiki.pl ( the freedom 2 surf server is very slow, expect delays ). -link seems broken, just fyi. -KlocWerk

The changes aren't major, but it would make using the admin functions a lot easier to use. I have not done any programming in perl, but have tried to copy the style of the current code. If someone would be willing to take a look at the code and check I'd be happy to supply it.

Hopefully something like this will be incorporated by CliffordAdams into the main code. I am also currently doing a modification of the code so that the login takes your username not an ID. If anyone has done this allready I would appreciate the code so I dont have to do the work myself ;). If you are interested send me something at ghast@zombieworld.com --Razar

As for the admin bar, I coded it without knowing you did it. I recommend posting any patches you make in WikiPatches. Get my admin bar from WikiPatches/GetAdminBar . And to the fellow below: yes you can easily attach it to the standard bar, but not customize its content. Right now it simply contains all admin functions. -- ElMoro

I'm not interested in the modification, but have a suggestion. Instead of making another bar and more complicated code, the current bar should be made customizable. I mean users should be able to add their own favorite pages to the bar. The default will be the site home page and RecentChanges, but the user can change and add to these (such as their own home page, an admin control page, or even direct admin actions like UseMod:action=maintain). I plan to add this to NoNameWiki? (the UseModWiki derivative running at http://lua-users.org/wiki/) in the future. NoNameWiki? also has the login/ID thing removed completely. My philosophy is that the prefs page should be so simple that the user doesn't mind re-entering them when using a different machine/browser. The login feature is not worth the user confusion it causes comment at (*) below.

Nice idea, I think I will do something like this, though you realise that most people will just create a page for themselves and place all the usefull links they want on that? The problem is that they are unlikely to find out how to use the more obscure actions that the cgi allows. Btw it does not really complicate the code to add the extra bars, since most of the functionallity is allready in the code. Its maybe 50 lines I think. My motivation was actually just to make the admin page lock command easier to use. Its much easier as admin to go to a page and either lock or unlock it based on a link than to type in the various options in the address bar. Also the way I did the Wiki Lock makes it immediately obvious when you are logged in as admin if the wiki is locked or not. I added the normal actions just for completeness. --Razar

You are only partially right: a page with the admin links won't have the same functionality as my WikiPatches/GetAdminBar since my adminbar has also links to lock/unlock the page currently displayed. --ElMoro

(*) The login feature is not worth the user confusion it causes I disagree, tho I think it should be re-documented. It is very useful for a restricted group of people (including where several share one machine, and where one uses several machines). It is a pain having to set several options each time, one number and one password does all my diff settings, length of edit window, and username. --RiVer

Using trans.pl

Though I can possibly dig this out of the wiki.pl code (and will, if I have to)....

Edit the text of this page
Your user name is $s
You are $s

We are using trans.pl at http://unumondo.com/cgi-bin/wiki.pl -- JerryMuelver

Answers -- Yes, and Yes. -- JerryMuelver (fyi page 404 on 10-Jan-2004)

-- SimonDavis
Is there a way to delete user "profiles" that does not have a username set and/or have not been used in X amount of time? I find that if I browse to the preferences using another computer (that does not have the cookie), a new user directory and file will be created, even though I will go and login to retrieve my own preferences, leaving a waste behind. How could that be avoided?. Thanks! -- DavidCollantes

Only 10 directories will be created, and future users will use only a single file per user. There is no simple way to remove profiles in the current code. You could possibly use the operating system to remove user files that have not been accessed recently. --CliffordAdams

<i>It would be good if the maintenance routine had an option to clean up profiles that haven't been accessed for a specified period. I too have the problem that I cannot delete any files in the database folder because they are owned by the system's "CGI-user"... - Geoffrey

Q. Can UseModWiki work with mod-perl 2.0?

I think it should work, but most of the mod-perl special handling should be done by the CGI.pm module that UseModWiki uses. If anyone has a problem using the wiki with mod-perl, please let me know and I'll try to fix it. --CliffordAdams

Q: Has anybody heard of or used WikiText and wt2db as a frontend to Docbook documentation efforts (and have sources)?

I recently learned about [wt2db], a perl module that converts WikiText files into [Docbook] XML. WikiText seems to be UseModWiki based and is used at the [Linux Documentation Project].

What I'm looking for is whatever patch to the UseModWiki is necessary in order for it to display in a browser the extensions that make up WikiText (e.g., id in sections, QandASets,<programlisting> tags...).


Got now an answer from David Merrill, the author of wt2db, saying that unfortunately:

There is no such thing. All wt2db can do is take a text file (it was originally written to process the contents of a Wikipedia page) and convert it into DocBook?. It is not at all integrated with any Wiki. That would be a great idea, but it's never been done and I won't be doing it any time soon because I don't have the need for it.

Maybe we can come up with something along those lines... -DanielHernandez

ExtractTexinfo produces a texinfo file, and then you can run `makeinfo --docbook yourwiki.texi'. -- AlexSchroeder

I would like to have the Search form use the "get" form method so that my web stats program can see the queries and produce a search word report. But, I would like to keep using the "post" form method on the edit page, because "get" seems to be limited to a certain number of characters. Any suggestions before I dive into the code? -- RogerPilkey

Just change the script so it emits method="get" instead of method="post". Simple as that. -- SunirShah

Thanks, Sunir. I modified sub GetFormStart to take a parameter, then I made the GetFormStart call in sub DoEdit to be Post, and left the other GetFormStart calls as Get. Seems to work. RogerPilkey

Q: I want to be able to make links by just putting an underscore between words. Are there any side effects to altering $LpA to be:

        $LpA = "(?:(?:$LpA)|(?:${AnyLetter}+_$AnyLetter+))";

It's around line 190-something. I set up a test wiki to play with it, and it seems to work ok. It recognizes regular WikiWords as well as stuff_like_this. I haven't examined all 4000+ lines of code to check for side-effects, though. Will I break anything with this alteration? --DavidWall

If you did break anything, it would probably be obvious pretty quickly. There might be some problems if you enable the Free Links feature, since it uses the _ character to represent a space in some cases (like links and filenames), but I think even those changes would be harmless. --CliffordAdams

I tried it with Free Links on. No obvious problems. Thanks for the quick response! --DavidWall

Ah. It does introduce a bug. I added the code above, went to page "ExamplePage?", added text_like_this. Saved it, and sure enough, text_like_this had a ? after it, so I clicked on it, which let me edit the "text_like_this" page. However, when I click on the title of the "text_like_this" page, the backlink to ExamplePage? doesn't show up. I'm sure the other code could be tweaked to make up for this, but I don't think it's worth it. I'll stick with [[Free Links]]. --DavidWall

Q. I want to add a BookMark? this page action

Say I am browsing a page, that I want to bookmark to come back to at a later date, if I had an action=BookMark?&id=MarkMe? that would automatically create an entry in my UserName? Page such as, say,

       [[MarkMe]] Date & Time of Bookmarking
I wonder if someone could offer any insight here. - Thanks Ajiva_Rts
An approach about that characteristic: UseMod:WikiPatches/InterestingPages. --JuanmaMP.

Q: I want to add pictures to a page. They are currently on my C: hard drive.

The pictures must be available for download somewhere. I assume that the directory C:\MyPictures? is not accessible from the web. Therefore, you must upload the pictures to a web server, first. Then you need to find out what URL will lead to these pictures, and once you have that, you can just put the URL on your wiki page and the picture should be inlined, there.

Important: The wiki does not allow you to upload pictures, unless you patch it (see WikiPatches).

Q: Is it possible to link every word?

I'd like to ask some questions about the LinkDatabase? feature provided by MeatBall:LinkDatabase. Is it available by default or has it to be patched? How is it implemented? (I studied the code some minutes, but couldn't find out. Maybe you can point me to it! :-) - I'd like to have a wiki where all words are checked for links without having special patterns except for escape characters. I'm a ZWiki user in general, but i remembered the LinkDatabase? feature here which might be necessary for such a modification, i guess. - What do you think? Any idea, links etc. are appreciated. - FlorianKonnertz, 03-02

I think that this would be very slow, and unusably slow on a public wiki with a large number of pages. If someone is interested in implementing that feature, I would not use the LinkDatabase?--I would use the automatically-created index file that is created if $UseIndex? is set to 1. Even in this case the word-by-word matching process would be slow for large wiki pages. --CliffordAdams

Take a look at MeatBall:GaGa to link all words (based on Moin Moin, I think). For the link data on the Meatball page: This is built in via the link action. -- AlexSchroeder

Q: Is it possible to have external links open in a new window?

so as not to lose the internal/external flow...


A: I found the patch... WikiPatches/OffsiteNewWindow

Q: I know this has been discussed, but is the hierarchy of pages idea still being considered (allow SubPages of SubPages?)? That is the one freature that I would love to have...

Thanks for the great Wiki and I love the Latex ability....

Hierarchies are not being considered. (Occasionally I have considered removing subpages, but some people really like them.) Also, the standard UseModWiki code doesn't include Latex features--I presume you are talking about OddMuse (a variant wiki which does have Latex features). --CliffordAdams

Q: Is it possible to configure the logo so that it leads to a page outside the wiki? Currently it links to the wiki home page but I'm using the wiki inside a site and would like to use the logo to get back out to site home page.

A: It is possible by making a small change to the code, but not through the configuration. In the GetHeader subroutine there is a line:

    $header = &ScriptLink($HomePage, "<$logoImage>");
Change this to read something like:
    $header = '<a href="http://www.othersite.com/">' . "<$logoImage>" . '</a>';
...replacing the "othersite" URL with the one you want to use. This should be the only change necessary. (I haven't tested this change.) --CliffordAdams

Thanks for the prompt response and its comprehensible manner. It works as stated. - StephenHay

Q: Have you considered making wiki pages or copies of them reachable by search engines, perhaps by creating a WikiArchive? as part of maintenance? I imagine there are pros and cons... --PaulMorrison

A: UseModWiki sites are usable by Google and some other search engines. It can help to add a line to robots.txt denying access to URLs like:


...so that search engines don't try to edit pages or view old revisions. I have considered writing an export-to-HTML function (which would make this easy), but I haven't had time to implement it. --CliffordAdams

Q: Let's suppose I didn't register with the usemod.com site's administrator. Can I wreak havoc all over the site?

A1: You could do that. A few people have caused problems on usemod.com in the past, creating hours of work for the volunteers who cleaned up the mess. I have blocked some IPs and domains which frequently cause problems. A few pages (like the home page and RecentChanges) are edit-locked. In the worst case, I do make frequent backups of the site. See WikiErase for more discussion. --CliffordAdams

A2: UseModWiki sites that do not want to allow open editing for everyone can use editor and/or admin passwords to restrict editing. See AdminFeatures for more information. --CliffordAdams

Q: I have modified my wiki to run locally on my computer and I use it as a database essentially, thanks to yours truly CA. Anyways, I can input images from external http sources, but cannot embed local files using local addresses, I think my problem is an address error, anyone with a mac osX have a suggestion?

A: How to modify to RunWikiLocallyOnOSX? --MichaelHerman

Q. Why is the parameter for requesting a page sometimes 'id' (for editing) and sometimes 'title' (for previewing)?

A: That's a good question, and I don't know why offhand. I might have chosen "title" for form submission (saving and previewing) in order to avoid possible confusion with user-id numbers, but that's just a guess. (It's also conceivable that "title" is one of the few surviving bits of the original AtisWiki code. I estimate that about 50-100 lines of AtisWiki are present in UseModWiki 1.0.) Right now I don't really want to change the working code without good reason, but thanks for bringing this up. --CliffordAdams

Q. Are there any plans to make the markup of UseModWiki compliant to W3C recomendations (XHTML or at least HTML4.01)? --SamWilson?

A1: No. --CliffordAdams

A2: No, but I'm willing to consider specific cases where non-compliance is a problem. The new $ParseParas? setting in 1.0 attempts to bring paragraph handling closer to compliance (when set to 1). I vaguely recall there were other issues that made 4.01 compliance difficult with the current code. --CliffordAdams

A3: Yes ;-) I try to make the script compliant to at least HTML 4.01 transitional. Expect this for 1.1 --MarkusLude

I'm interested in working on compliant with HTML for UseMod, too. How much advanced on this subject is being?. Please, what would be a good point/site to match for the beginners?. Meanwhile, I would like reaching more by myself . Thanks. --JuanmaMP
http://validator.w3.org --JuanmaMP

Q. It is my understanding that the data in UseMod implementation is stored in flat files. Does anyone have any data regarding scaling problems? E.g., at what point does performance become an issue? How many pages are currently in the UseMod site database?

A: I intended UseModWiki to work with at least 10,000 pages. This site has over 1500 pages, and the [Meatball wiki] has over 2700 pages. I have heard of UseModWiki sites with over 10,000 pages that had adequate performance. One other data point: the Wikipedia project used UseModWiki during its initial growth phase, and it handled more than one MeatBall:SlashdotEffect event fairly well.

There are a few areas where performance can suffer with larger numbers of files. The first one is searching--the wiki will search all the page files for every search. The second problem that can occur is a slowdown due to having hundreds or thousands of files in a single directory. The wiki divides pages/files based on their first letter which helps somewhat, but a large number of files will slow down all file-accessing operations. This second problem used to be a major concern with old filesystem implementations, but modern filesystems will handle several thousand files per directory without problems.

If scaling is a major concern, you may want to look at [MediaWiki], which is the software used by the Wikipedia projects. --CliffordAdams

Q: I'm looking for an easy way to distinguish between links to page requests and links to action requests. Any hints? --MarkusLude

A: For most purposes (like excluding robots) you can consider all URLs of the form "...wiki.pl?action=" to be action requests. There is a "browse" action, but that is only typically used by the difference links and links to old revisions (which you usually want to exclude anyway). --CliffordAdams

Q: Right now UseMod uses rss very limited: a link to the page and only the Summary (without any formating) as content. Could this be changed? I would like to see it contain (optional) the full page (the reversion referred too). Would this be posible? -- GideonKlok?

A: It would be possible, but it would not be trivial. I do not intend to add such a feature, but I would be willing to give a little help if someone else wants to add it. (One would have to copy some code from the BrowsePage subroutine to GetRssRcLine.) --CliffordAdams

Q. How can I get rid of the question marks that show up next to words I type that should not turn into links? i.e. MySQL? --Erik Weibust

You can surround the text with "nowiki" tags which prevent any wiki rules from applying to the text. For example <nowiki>MySQL</nowiki> appears as MySQL. You might find it easier to create a MySQL? page if you mention it often. --CliffordAdams

Q: has anyone modified UseMod such that true authentication works? Because I don't mind when people just edit the pages, as long as they at least are registered and have to log in. -- P Ramakers

Q: as an alternate method of creating new pages is there a way of having sth like a [New] tag in UseModWiki like in [CocoaDev] or else a way of getting a form working with the wiki.pl using raw html like in the following: --TobiasSchwinn

<form method="POST" action="wiki.pl">
      <p>Page Title: <input type="text" name="title">
      <p><input type="submit" name="Save" value="Save">

A: i found a way of doing this in raw html. just paste the following into ur wiki page:

<form method="POST" action="wiki.pl">
  <input type="hidden" name="action" value="edit" />
  <p>Page Title: <input type="text" name="id" />
  <input type="submit" name="Save" value="Create" />

Q: Is there a simple way of creating a breadcrumb across the top of the page to keep track of the pages you've visited? -- P Breen A: Can this script help you? http://www.fifegeek.com/webdesign/perl/perlcrumbs.shtml

Q: Changing the encoding of QUERY_STRING env.variable before "new CGI;" called.. is it ok?

There are some situation that browser's request includes multi-byte string. For example: (I'm living in South Korea)

In those case, XXXX can be encoded using UTF-8 or EUC-KR(in Korea, for example) according to the option in the browswer. ("Send URL in UTF-8" in IE, "network.standard-url.encode-utf8" in FF, etc.)

I wanted my wiki support both encoding and I am trying to modify wiki.pl

At first, I tried to check the value which I got from GetParam() like this:

$id = &GetParam('id');
$id = &guess_and_convert($id);

# "guess_and_convert" subroutine guesses the encoding of parameter
# using Encode::Guess module. If not UTF-8, it converts the parameter
# to UTF-8 encoded string and return it.

However, there are so many "GetParam()"s in wiki.pl and I found that it's almost impossible, or so inconvenient to check whenever the parameters are fetched.

Second, I tried to "check and convert" $ENV{QUERY_STRING} value before a CGI object is created:

# convert QUERY_STRING to UTF-8 here 
$ENV{QUERY_STRING} = check_and_convert($ENV{QUERY_STRING}); 
# then create CGI object 
$q = new CGI; 
# I can get name=XXX and XXX is encoded in UTF-8 
$name  $q->param("name") 

In this case, I think, I don't need to check each parameter in any other following codes... All the values are now UTF-8 encoded.

As far as I had tested, it looked successful. But I'm not sure that such approach is good(?) and safe, because I'm trying to change an environment variable.

In addition, I've already applied WikiPatches/SlashLinks to my wiki, and I found that DoCacheBrowse uses "$ENV{QUERY_STRING}" before "new CGI;" is called in InitRequest.

Therefore, my final code is:

sub DoWikiRequest {
### for SlashLinks. I moved these 4 lines from InitRequest to here
    if ($SlashLinks && (length($ENV{'PATH_INFO'}) > 1)) {
        $ENV{'QUERY_STRING'} .= '&' if ($ENV{'QUERY_STRING'});
        $ENV{'QUERY_STRING'} .= substr($ENV{'PATH_INFO'}, 1);

### here, I change (if needed) $ENV{'QUERY_STRING'} into the UTF-8 encoded string
    $ENV{'QUERY_STRING'} = guess_and_convert($ENV{'QUERY_STRING'});

### original code
    if (!&DoCacheBrowse()) {
        eval $BrowseCode;
        &InitRequest() or return;
        if (!&DoBrowseRequest()) {
            eval $OtherCode;

What do you think about my approach? Am I missing something or making a mistake? Any advices would be appreciated. I'm sorry I'm not good at English. -- GyPark

Q: To implement a macro feature, I need to open and read from a second page while rendering the current page. OpenPage sticks page contents into a global variable, so calling OpenPage while rendering a page will clobber the current page. Must I write a second, non-clobbering open page function? [subquestion: why in the world does wiki.pl use global variables in the first place? They're deprecated for exactly this reason!] -- Mark

Q: MonthsInEnglish

WikiBugs/MonthsInEnglish is not fixed in 1.0.4 but it appears as "Fixed (mostly from 0.92)" in WikiBugs; as finally that is an overload even in recentchanges, then its state is really "Not Resolved" or "won't be fixed"? (best the second one?). Thanks.--JuanmaMP

Q: Why Sub DoRandom with &ReBrowsePage? Is possible this?
sub DoRandom {
  my ($id, @pageList);

  @pageList = &AllPagesList();  # Optimize?
  $id = $pageList[int(rand($#pageList + 1))];
-  &ReBrowsePage($id, "", 0);
+  &BrowsePage($id); 

  1. Why not use XML for the database, since the HTML is escaped anyway
  2. Why are the directories subdivided by initial letter? eg the file for HomePage is in datadir/H/ Is this just to avoid having thousands of files in the same directory?

Answers (opinions anyway) from ChuckAdams:

XML is not a database, it is a format. While there are so-called "XML databases", they are essentially persistent structures designed for persisting XML. Unless W3C or OASIS comes up with some standard better than DOM for handling "forests" of data and making it persistent, using XML would add an extra layer for no net benefit. Were you to want to query the wiki through xpath or render multiple pages through XSLT, then the various tools related to XML would provide some benefit .. but do note that most of them have enormous memory requirements for any non-trivial dataset. Also note that XML doesn't really need escaping if you put content in CDATA sections; the problem with CDATA sections is if you have a ]]> anywhere in your data, you have to scan for it and adopt some escaping convention yourself, because there is NO nondestructive way to escape that sequence.

Yes, the directories are divided by the first letter to avoid putting too much in one dir. Filesystems like ext2 (and ext3 for the most part) do not scale well with many thousands of files in a single directory. It's an old-school unix trick (along with lock directories), but even ReiserFS? will tend to bog at around 50,000 entries in a single directory (not a problem for most wikis, granted. I've put 300,000 files in one directory before for an analysis app. Directory reads are fine, writes bog down).

'''Q: $EditAllowed? seems similar to Lock Site.
Except $EditAllowed? is defined in config file and Lock Site trough Admin Bar, but that sounds as redundancy. Maybe a prune?

UseModWiki | UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 24, 2013 9:07 pm by MarkusLude (diff)