[pmwiki-users] deleted pages in pagelists

Peter Bowers pbowers at pobox.com
Tue Dec 2 12:31:39 CST 2008


When a page is deleted it's, well, um, deleted.  It's not meant to be viewed
within pmwiki anymore.  It's kept around in that *,del-timestamp form so
that an *administrator* can go behind the scenes (either ftp or command
line) and rename it to undelete it.  So I don't believe the capabilities you
are looking for exist - deleted files are meant to be inaccessible by
design.

 

You may find a single place in the source (or a few) where it can be changed
to allow them to be viewed, but more likely you'll have to write a recipe
(or find one) that allows you to view and undelete deleted pages.  (Note
that changing core source is frowned on because of the difficulty it
presents when you upgrade.)  If you really need true browse/view/edit
privilege on deleted pages then you could theoretically write a different
pagestore class but you've got some relatively insurmountable obstacles in
doing that (if the same page was created and deleted and created and deleted
then you have 2 of the same page out there in the deleted form, each with a
different timestamp - which one would you choose?).  It also seems somewhat
strange to give that kind of capability to "deleted" pages -- but you know
your functional specs.

 

Reading a page "from scratch" is not that difficult (see the read() function
within the pagestore class).  You could set up some kind of markup or
?action=readdeleted or something like that which would read a given file on
disk and display the contents on a page.  I can foresee your cookbook (that
already returns a list of filenames) returning them in a form something like
this:

 

* [[Page.X?action=readdeleted?pn=Mygroup.Myfile1,del-01234|Mygroup.Myfile1]]

* [[Page.X?action=readdeleted?pn=Mygroup.Myfile2,del-03412|Mygroup.Myfile2]]

* [[Page.X?action=readdeleted?pn=Mygroup.Myfile3,del-01456|Mygroup.Myfile3]]

 

Page.X is pretty unimportant - whatever is there will probably just be
ignored as long as the action is readdeleted.  Or, if you don't like setting
up a new ?action= then you could have some special markup on Page.X which
would look at the $_GET['pn'] and replace with the contents of the deleted
page.  (Note that you have a bit of processing on the contents of the page
after you fread() or fgets() it, notably finding the line that starts with
text= and then doing a search/replace of %0a with carriage returns -- it's
actually a bit more complicated than that, but that's the basics - see
PageStore.read() for how it's meant to be done).

 

Looking at it from another perspective you could override the delete
capabilities (by extending the pagestore class with an override delete()
function) so that instead of deleting the page (which actually renames it to
group.page,del-timestamp) you would rename it and put it some group (like
"Deleted").  Thus when you "deleted" the page Hello.World it would be moved
to Deleted.Hello-World or something like that.  Then you don't have to do
anything else except to exclude pages from the Deleted group in typical
pagelists and handle everything else in absolutely standard, vanilla pmwiki.
This is a much more elegant solution, but unfortunately it leaves any
already deleted files inaccessible - it only helps for pages that are
deleted after the change is made.

 

Long answer to a short question - I hope that helps get you started in the
right direction.

 

-Peter

 

  _____  

From: pmwiki-users-bounces at pmichaud.com
[mailto:pmwiki-users-bounces at pmichaud.com] On Behalf Of Thierry
Vanderschueren
Sent: Monday, December 01, 2008 8:59 AM
To: pmwiki-users at pmichaud.com
Subject: Re: [pmwiki-users] deleted pages in pagelists

 

Hi, 
this doesn't work.
Isn't there somewhere in the source code a pattern that excludes all files
named ".*?,del-.*" from the pagelists ?

Thierry

2008/11/29 noskule <noskule at gmx.net>

Am Freitag 28 November 2008 14:30:57 schrieb Thierry Vanderschueren:

hi Thierry
delete the file wiki.d/.pageindex. As far as I remember this should usually
do
the trick.
grz nos



> Hi,
>
> I would like to display in a page the list of deleted pages in a group.
> As the deleted pages are skipped from the search and page list results, I
> tried the following without success :
>
> in the MyGroup.DeletedPages.php file : $SearchPatterns['deleted'][] =
> '/MyGroup\..*?,del.*?/';
> in the MyGroup.DeletedPages wiki page : (:pagelist list=deleted:)
>
> This doesn't work.
>
> Then, I tried writing a small cookbook that opens the wiki.d directory and
> scans it for all MyGroup\..*?,del.*? files and shows them as wikilinks in
> the page. This works but of course the wikilinks do not work, they appear
> with the question mark after them.
>
> Is there an easy workaround ?
>
> Thanks for your cooperation
>
> Thierry



_______________________________________________
pmwiki-users mailing list
pmwiki-users at pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20081202/788238e6/attachment-0001.html 


More information about the pmwiki-users mailing list