This is a disclaimer:
Using the notes below is dangerous for both your sanity and peace of mind.
If you still want to read them beware of the fact that they may be "not even wrong".

Everything I write in there is just a mnemonic device to give me a chance to
fix things I badly broke because I'm bloody stupid and think I can tinker with stuff
that is way above my head and go away with it. It reminds me of Gandalf's warning:
"Perilous to all of us are the devices of an art deeper than we ourselves possess."

Moreover, a lot of it I blatantly stole on the net from other obviously cleverer
persons than me -- not very hard. Forgive me. My bad.

Please consider it and go away. You have been warned!

PMWiki Admin Howto

In the following $wikiroot = /raid/web/var-www/www-test is the root of the PMWiki installation.


Where is the pmwiki ?

  • Currently on gertrude/www in /raid/web/var-www/www-test.
  • See gertrude:/etc/apache2/sites-enabled/000-www.
  • There is a symlink /export_www → /raid/web.
  • At some point www-test should be changed! … linked www-current → www-test.

To change the admin password manually:

    $ ssh www
    $ cd /export_www/var-www/www-test
    $ IPASS=`easypass -s -p 1` &&   EPASS=`echo $IPASS | mkpasswd -Hmd5 -s` &&  echo "$IPASS -> $EPASS"

Put $EPASS in %/cookbook/userauth2/profiles/admin%


How to add a new user ?

Login as admin and click on Admin tool at the bottom of the page - the rest should be obvious!


How to allow a user to edit a section, ie change her permissions?

  • Login as admin, on Admin tool at the bottom of the page and edit the user profile.
  • Instructions and examples are provided by the tool.
  • EG, to allow user jane to modify/edit page www.bic.mni.mcgill.ca/SomeLab/SomePage

add the following in the tables of permissions granted by admin:

ed_SomeLab.SomePage,
ed_SomeLab.SomeOtherPage

Multiple entries on many lines must be separated by commas ‘,’


How to setup uploads with the PMWiki?

This is convoluted as it involves the configuration details of the PMWiki, Apache and PHP installation.

PMWiki is very much anal about this for security reasons. More details can be found at http://www.pmwiki.org/wiki/PmWiki/UploadsAdmin

Enable uploads

To enable uploads set $EnableUpload in $wikiroot/local/config.php:

$EnableUpload = 1;

Verify the values $UploadDir and $UploadUrlFmt that specify the local directory where uploaded files should be stored, and the URL that can be used to access that directory. By default, $UploadDir and $UploadUrlFmt assume that uploads will be stored in a directory called uploads within the $wikiroot directory. This is defined in $wikiroot/scripts/upload.php:

SDV($UploadDir,'uploads');
SDV($UploadUrlFmt,preg_replace('#/[^/]*$#', "/$v", $PubDirUrl, 1));

Do not touch those!

Upload password/authentication

In $wikiroot/local/config.php comment out the following if set:

$DefaultPasswords['upload'] = crypt('secret');

As it just sets a single password for uploads for the entire PMWiki. Instead insert the following:

$HandleAuth['upload'] = 'edit';

This will allow users with edit permissions to use the action upload as in http://some_url/?action=upload.

More on that below.

Uploads can be configured site-wide, by-group (default), or by-page by changing $UploadPrefixFmt in $wikiroot/local/config.php.

The default value is set into $wikiroot/scripts/upload.php:

SDV($UploadPrefixFmt,'/$Group');
SDV($UploadFileFmt,"$UploadDir$UploadPrefixFmt");

So by default, an attached file is associated with a WikiGroup — that is, all of the uploads for a particular group are combined in one subdirectory. See http://www.pmwiki.org/wiki/Cookbook/UploadGroups for more details.

Uploading a file

Once the upload feature is enabled, authors can access the upload form by adding ?action=upload to the end of a normal PMWiki url. The author will be prompted for an upload password similar to the way other pages ask for passwords.

Another way to access the upload form is to insert the markup Attach:myfile.ext into an existing page, where myfile.ext is the name of a new file to be uploaded. When the page is displayed, a ?-link will be added to the end of the markup to take the author to the upload page.

Upload file versions

PMWiki doesn’t manage the versionning of uploaded files by default. This can be changed by setting $EnableUploadVersions=1 in $wikiroot/local/config.php. I haven’t yet tested it but I think when on PMWiki will tack a timestamp at the end of the ‘old’ file before uploading the ‘new’ version.

Upload file restrictions

The $wikiroot/scripts/upload.php script performs some basic verifications before storing the uploaded file. There are restrictions imposed on:

filenames: can contain only letters, digits, underscores, hyphens, spaces, and
periods, and the name must begin and end with a letter or digit.
file extensions: only a certain extensions are permitted. They are defined
in the array $UploadExts in $wikiroot/scripts/upload.php.
No php or cgi files are allowed by defaut btw.
To add a new extension to the list of allowed upload types, add a line like
the following to a local customization file $wikiroot/local/config.php:
        $UploadExts['ext'] = 'content-type'; 
Define $UploadBlacklist = array(‘.php’, ‘.pl’, ‘.cgi’); if you wish to forbid
uploading files with an embedded .php, .pl or .cgi extensions like file.php.txt.
file size: max is specified by $UploadMaxSize in $wikiroot/local/config.php
but more on this below as the max file size can be modified by the apache
and/or the php config.

More on upload file size limits:

Upload sizes are restricted by a few variables values. The quota values can be set per group:

$UploadPrefixQuota = 1000000; # limit group uploads to 1000KB (1MB) 

Or et the level of the entire PMWiki:

$UploadDirQuota = 10000000; # limit total uploads to 10000KB (10MB)

Default values are zero (unlimited) in $wikiroot/scripts/upload.php.

Other settings affect the upload file size limits:

  • Apache2

The LimitRequestBody directive set in the apache2 core module restricts the total size of the http request body sent from the client:

LimitRequestBody 0 (unlimited/default). 
  • PHP

PHP has 2 limits for file uploads in /etc/php5/apache2/php.ini:

upload_max_filesize = 2M
post_max_size = 8M

They are presently overidden in $wikiroot/.htaccess at the root of the PMWiki:

php_value upload_max_filesize 32M
php_value post_max_size 32M

With those variables in place—pmwiki’s maximum file size, apache’s request-size limits, and the php file size parameters, the maximum uploaded file size will be the smallest of the three variables.

PHP setup:

You can verify the PHP settings online with http://www.bic.mni.mcgill.ca/info.php

or with http://www.bic.mni.mcgill.ca/?action=phpinfo

if $EnableDiag = 1 in $wikiroot/local/config.php.

PHP allows uploads if in /etc/php5/apache2/php.ini:

file_uploads = On

Finally, make sure the temp directory is set correctly:

upload_tmp_dir = /tmp

How can one see who is actively updating their pages?

http://www.bic.mni.mcgill.ca/Site/AllRecentChanges


How is this beast structured ?

I don’t yet have a definite answer, but here are some important files …

   cd /export_www/var-www/www-test # this is the current root!

   under ./local/, one can find config.php

   under ./pub/skins/BICMain/, one can find some of the root files for the wiki …

         ie, bic.css, bic.tmpl, design.css, layout.css and images/

   under ./wiki.d/, one will find all of the BIC contents: … site SideBar as well …

         ./wiki.d/Site.SideBar

   under ./wikilib.d/, one will find some of PmWiki’s core files … in fact this probably needs
         to be upgraded as the most recent file in there in Jan 19 2009 !

How do I change a user’s status ? Changing from Student to PostDoc or Postdoc to Staff ?

Simply by moving the pages …, e.g.

    cd /export_www/var-www/www-test
    mv wiki.d/PeoplePostdoc.FonovVladimir wiki.d/PeopleStaff.FonovVladimir
    mv wiki.d/PeoplePostdoc.CampbellJennifer wiki.d/PeopleStaff.CampbellJennifer

How do I make a page editable ?

~here should be a ! (bang) immediately following ^text= as in text=!

   the downside of this feature is that a user could remove the !, hence remove the
   *editability* of the page!

However I think that one can use the Edit button below the ACTIONS menu on the left. At least it used to work for me!