SharedPages-Talk
<?php if (!defined('PmWiki')) exit(); SDV($HandleActions['share'], 'HandleShare'); SDV($HandleAuth['share'], 'edit'); function HandleShare($pagename) { rename("wiki.d/$pagename","../shared.d/".basename($pagename)); Redirect($pagename); } SDV($HandleActions['unshare'], 'HandleUnshare'); SDV($HandleAuth['unshare'], 'edit'); function HandleUnshare($pagename) { rename("../shared.d/$pagename","wiki.d/".basename($pagename)); Redirect($pagename); } ?>
Shared groups
Here is a working example for sharing groups of pages, where all new pages in the shared group are placed in the shared group directory (noting the use of Per Group Sub Directories for wiki.d and sharedwiki.d page stores).
path
was replaced by ../../..
in the working configuration.
In config.php (for the website with the sharedwiki.d
directory)
$WikiDir
= new PageStore('wiki.d/$Group/$FullName'); # writeable directory per group page store$WikiLibDirs
= array( &$WikiDir
, new PageStore('$FarmD
/wikishared.d/$Group/$FullName', 0), # readable directory per group pagestore new PageStore('$FarmD
/wikilib.d/$FullName')); # PmWiki default pages
In config.php (for the website wanting to access the sharedwiki.d
directory)
$WikiDir
= new PageStore('wiki.d/$Group/$FullName'); # writeable directory per group page store$WikiLibDirs
= array( &$WikiDir
, new PageStore('$FarmD
/path/wikishared.d/$Group/$FullName', 0), # readable directory per group pagestore new PageStore('$FarmD
/wikilib.d/$FullName')); # PmWiki default pages
This lets the shared pages to be read (eg by page lists, searches).
In the SharedGroup.php (for the website with the sharedwiki.d
directory)
## only alter the directories when a page is posted in this group if (@$_REQUEST['action']=='edit' && preg_grep('/^post/', array_keys($_REQUEST) ) ) { $LockFile = "$FarmD
/wikishared.d/.flock"; # set lockfile to shared group$WikiDir
= new PageStore('$FarmD
/wikishared.d/$Group/$FullName', 1); # writeable shared directory per group pagestore$WikiLibDirs
= array( &$WikiDir
, new PageStore('wiki.d/$Group/$FullName', 1), # writeable directory per group pagestore new PageStore('$FarmD
/wikilib.d/$FullName') ); # PmWiki default pages }
In the SharedGroup.php (for the website wanting to access the sharedwiki.d
directory)
## only alter the directories when a page is posted in this group if (@$_REQUEST['action']=='edit' && preg_grep('/^post/', array_keys($_REQUEST) ) ) { $LockFile = "$FarmD
/path/wikishared.d/.flock"; # set lockfile to shared group$WikiDir
= new PageStore('$FarmD
/path/wikishared.d/$Group/$FullName', 1); # writeable shared directory per group pagestore$WikiLibDirs
= array( &$WikiDir
, new PageStore('wiki.d/$Group/$FullName', 1), # writeable directory per group pagestore new PageStore('$FarmD
/wikilib.d/$FullName') ); # PmWiki default pages }
The wiki.d
directory is set writeable to allow some Site and SiteAdmin group pages to be written (eg RecentChanges, Site.AllRecentChanges, Blocklist pages (Chongqed etc)).
Simon September 15, 2009, at 08:17 PM
Talk page for the SharedPages recipe (users).