[pmwiki-users] pmwiki mirrors

Petko Yotov 5ko at 5ko.fr
Mon Mar 29 02:19:27 PDT 2021


Yes, it is possible, I use this on a number of websites -- either a home 
server like your case, or a "backup snapshot" of a website from the 
previous night.

To do it, you can have in config.php a conditional based on the server 
name or the server address.

It will help if you have the same server software (e.g. Apache) and PHP 
version on both installations, or have slightly newer versions at home.

You don't need to use relative links, you need to define different 
values to the $EnableReadOnly, $ScriptUrl, $FarmPubDirUrl, $PubDirUrl, 
and $UploadUrlFmt variables.


   if($_SERVER['SERVER_ADDR'] == '127.0.0.1') { # home server
     # or possibly $_SERVER['SERVER_NAME'] == "localhost"
     $ScriptUrl = "http://127.0.0.1/~user/www/pmwiki.php";
     $FarmPubDirUrl = $PubDirUrl = "http://127.0.0.1/~user/www/pub";
     $UploadUrlFmt = "http://127.0.0.1/~user/www/uploads";

     # this is to remind me I am on the home server
     $HTMLStylesFmt['Local'] = '#wikitext {background-color: #ffe 
!important;}';
     $WikiTitle = 'Local wiki';
   }
   else { # online server
     $EnableReadOnly = 1;

     $ScriptUrl = "https://www.your-website.org/wiki/";
     $FarmPubDirUrl = $PubDirUrl = 
""https://www.your-website.org/wiki/pub";
     $UploadUrlFmt = ""https://www.your-website.org/wiki/uploads";

     $WikiTitle = 'Online wiki';
   }

I believe there are some aggressive caching recipes that you may have to 
disable, or to skip the *,cache files from the home server when you 
rsync.

The next step may be to have a static export and rsync that to the 
online server (although, no search, authentication, PmWiki conditionals, 
{(ftime)} markup expressions or other interactive server-side features). 
Static export is not an easy task though.

Petko


On 29/03/2021 10:46, jdd at dodin.org wrote:
> I would like to have a pmwiki mirror at home, where I have a local 
> server.
> 
> May main site is on a shared server and is sometime very difficult to
> use due to excessive load on this server and I want to make the
> editing on my own network and rsync the result to the online shared
> server.
> 
> my own local server may also be unavailable in case of power failure
> (not that rare nowadays here).
> 
> But for this to works, I have to use relative links all over the wiki
> pages as of course the domain name of the two servers will not be the
> same. for example in local/config.php
> 
> is this possible without breaking pmwiki?
> 
> is it possible to make the online pmwiki read only for the web server
> (of course not for rsync :-)?



More information about the pmwiki-users mailing list