[pmwiki-users] Immutable

Petko Yotov 5ko at 5ko.fr
Wed Apr 9 13:22:48 PDT 2025


On 09/04/2025 21:35, t20250408pmwiki at logand.com wrote:
> 1) What would break if I used html5 in a custom template instead of
>    xhtml?  Is it better to stick with xhtml?

No, I recommend using html5, but there are some additional 
configurations to make it mostly valid html5, see the skin 
pmwiki-responsive (in skin.php).

You could copy pmwiki-responsive to a new folder and customize it there.

> 2) I use NixOS and keep all immutable stuff in read only /nix/store.
>    Unfortunatelly, because of the way pmwiki is structured,
>    I have to symlink so much stuff into the mutable dataDir:
> [...]
>    Is there a way to minimize this symlinking somehow?
>    Ideally, there would be read-only directory for immutable stuff
>    and read-write directory for mutable stuff (wiki.d and uploads)
>    and these two would not need to be mixed.

You only symlink pmwiki/pub.

Yes, you can do this as a "wiki farm" with a single field, and locally 
present directories like mutable/local, mutable/uploads, mutable/pub, 
mutable/pub/css, mutable/pub/skins/yourskin, are used instead of the 
core ones. Also mutable/wiki.d will be created next to mutable/index.php 
if it is not there.

Check this page:

   https://www.pmwiki.org/wiki/PITS/01501

Basically you have mutable/index.php that includes the immutable 
pmwiki.php, and a bunch of local directories and configuration files 
that will be used by the field.

You only symlink pmwiki-2.4.3/pub into mutable/pmwiki-pub and 
reconfigure $FarmPubDirUrl in config.php like this:

   $FarmPubDirUrl = 'https://example.com/pmwiki-pub';


PmWiki will load the core skins, styles, javascripts from $FarmPubDirUrl 
and your own skins and styles from $PubDirUrl which should be 
autodetected, or set it to:

   $PubDirUrl = 'https://example.com/pub';

This also makes it easy to upgrade the core, or safely test the new 
version and roll back by either renaming the immutable directory or by 
re-symlinking it.

You absolutely don't have to patch the core, everything is configurable.

I would place the pmwiki directory outside the server root.

For extra security you could move both local/ and wiki.d/ outside of the 
server document root, these are configured with $LocalDir (in index.php 
before including pmwiki.php) and both $WorkDir and $WikiDir (in 
config.php) - look these up in the documentation.

Petko


>   system.activationScripts.ensure-pmwiki = ''
>     if ! test -d ${dataDir}; then
>       mkdir ${dataDir}
>     fi
>     chown ${app}:${app} ${dataDir}
>     chmod 755 ${dataDir}
>     ln -sf ${pmwiki}/share/pmwiki.php ${dataDir}
>     ln -sf ${pmwiki}/share/pub ${dataDir}
>     ln -sf ${pmwiki}/share/scripts ${dataDir}
>     ln -sf ${pmwiki}/share/wikilib.d ${dataDir}
>     ln -sf ${indexPhp} ${dataDir}/index.php
>     ln -sf ${local}/local ${dataDir}
>     ln -sf ${robotsTxt} ${dataDir}/robots.txt
>     if ! test -d ${dataDir}/wiki.d; then
>       mkdir ${dataDir}/wiki.d
>     fi
>     chown -R ${app}:${app} ${dataDir}/wiki.d
>     if ! test -d ${dataDir}/uploads; then
>       mkdir ${dataDir}/uploads
>     fi
>     chown -R ${app}:${app} ${dataDir}/uploads
>     systemctl restart phpfpm-pmwiki
>   '';
> 
>    Is there a way to minimize this symlinking somehow?
>    Ideally, there would be read-only directory for immutable stuff
>    and read-write directory for mutable stuff (wiki.d and uploads)
>    and these two would not need to be mixed.
>    One idea would be to have web server root in the read-only 
> /nix/store
>    and somehow configure the location of the wiki.d and uploads
>    directories in config.php.  Is this possible?
> 
>    The way wikilib.d and wiki.d work is kind of overlay, where
>    rw files in wiki.d can overlay ro files in wikilib.d.
>    Would it be possibe to do something like this for skins,
>    so that can overlay custom skin dir and I do not have to "patch"
>    the upstream pmwiki-2.4.3 package?  Maybe an overlay for the whole
>    pub/ directory?
> 
> Cheers,
> 
> Tomas



More information about the pmwiki-users mailing list