Not logged in. · Lost password · Register
Forum: General Help and Support Syntax and Usage RSS
Delete several pages at once
How do I delete all pages that begin with: "wiki:news:"
Avatar
yasBro #1
Member for 2 months · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: Delete several pages at once
Hello,

I couldn't find a solution for this problem on the website, therefore I am writing here.

My Problem:
I want to delete all pages, which begin with "wiki:news:"
e.g. wiki:news:xyz:20181024 or wiki:news:xyz:20170104
These are about 500 pages, including about 400 pictures

My Question:
Is there a way to delete all those pages at once without opening and deleting every single one? The best would be, if the pictures/documents of these pages would be deleted aswell.

Thank you very much for your help.
Avatar
MartinR #2
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
# rm -r <dokuwikibase>/news/*

If you are still using Windows then you can try deleting through Explorer if you're wary of the command line.
Avatar
Michaelsy #3
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
# rm -r <dokuwikibase>/news/*

In any case, the pictures will not be deleted by this command. Media files have their own directory respectively subdirectories.

(And then the question arises whether the 400 images in question have already been stored separately in a separate namespace / directory. Or if they are in the middle of other pictures.)

A full backup is urgently recommended before such a measure.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
This post was edited 2 times, last on 2018-10-25, 00:46 by Michaelsy.
Avatar
MartinR #4
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
True.  IF the OP has all images in a similar hierarchy then the corresponding command can be applied to the media directory.  In any case I would hope that a brief nudge was not undertaken without thought -- rm -r ought to trigger a 'check - double check - am I really sure' response in any user or admin!
Avatar
Michaelsy #5
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
And all archived older versions of the articles will not be deleted also.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
MartinR #6
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Doesn't recent_days control the deletion of old copies?  The default seems to be 7 days.  Reading bin/dwcleanup would seem to indicate so.
Avatar
Michaelsy #7
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Quote by MartinR:
Doesn't recent_days control the deletion of old copies?  The default seems to be 7 days.  Reading bin/dwcleanup would seem to indicate so.

No, recent_days will not delete any archived versions. This only determines the length of a maintained log, listing the most recent changes. As far as I know, this protocol is truncated / trimmed once a day.

Take a look at the manual:
How many days of recent changes should be kept in the global recent changes list?

Furthermore: https://www.dokuwiki.org/devel:changelog
The changelog is stored in per-page changelog files, with a recent changes cache. The recent changes cache is kept in /data/meta/_dokuwiki.changes and trimmed daily.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
This post was edited on 2018-10-25, 13:32 by Michaelsy.
Avatar
MartinR #8
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Hmm, where are archived versions then?  I have always thought they would be in *atticbin/dwcleanup includes the line:
find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete
as well as
find "${data_path}"/cache/?/ -type f -mtime +${retention_days} -delete
.  Wouldn't the first line remove the archived copies?
Avatar
Michaelsy #9
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Quote by MartinR:
find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete

Sorry, I do not understand what this code does.

Can you take a look into your own DokuWiki, if any old version were ever deleted automatically? I have never experienced this and have been working with DokuWiki for years.

You can recognize deleted archive versions. These are still listed in the change log of the page, but then the link to them is missing. Since they are no longer accessible.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
Michaelsy #10
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Incidentally, the archived versions are retained even if you delete a page. Better said, if its content is deleted. Even if "This topic does not exist yet" appears, the "Old revisions" button still works.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
Avatar
MartinR #11
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
find "${data_path}"/{media_,}attic/ -type f -mtime +${retention_days} -delete
expands to
find ${data_path}/media_attic/ ${data_path}/attic/ -type f -mtime +${retention_days} -delete
so it will search the trees {data_path}/media_attic/ and ${data_path}/attic/ for all normal files (type "f") where the modification time (mtime) is greater than ${retention_days} ago.  All such files are deleted.

See find(1) for full details.


I've got quite a nice image showing exactly that, but I'm having a spot of bother attaching an image to posts on this forum.  A text representation would be:

These are the older revisons of the current document. To revert to an old revision, select it f...
  [ ] 2018/10/21 21:46     user:op:start – rm Infiniband & Browsers. Add ... -26 B (current)
  [ ] 2018/10/19 13:36 o^o user:op:start – mv logs into oper jmr (::1) -30 B
      2018/08/04 21:07     user:op:start – adjust jmr (::1) -276 B
      2018/08/04 20:50     user:op:start jmr (::1) -19 B
      2018/08/04 20:48     user:op:start – rm old stuff jmr (::1) -315 B

[ ] represents a checkbox, o^o the difference spectacles.  On the first two lines user:op:start is shown in blue and hovering over either link shows the URL including the appropriate revision number.
Avatar
Michaelsy #12
Member since Jun 2015 · 569 posts · Location: Düsseldorf, Germany
Group memberships: Members
Show profile · Link to this post
Ok, what you are describing is a possible way to maintain DokuWiki. As described here: https://www.dokuwiki.org/tips:maintenance [*1]

But this is not the standard functionallity of DokuWiki. In a default installation there is no bin/dwcleanup file.

Look at the screenshot attached. Setting recent_days is set to "7" and the old revisions extend into 2016.

Here is a direct link to the old revisions: http://singen.informantum.de/doku.php?id=start&do=revi…


[*1] You can read there:
To run it automatically, set up a cronjob.
By Patreon.com a few eurons can be fed into the code phasers of
the DokuWiki engine. Besides, Andi's posts are worth reading.
The author has attached one file to this post:
Recent_days.png 126.6 kBytes
You have no permission to open this file.
This post was edited 2 times, last on 2018-10-25, 17:05 by Michaelsy.
Avatar
MartinR #13
Member since Jul 2015 · 104 posts · Location: UK
Group memberships: Members
Show profile · Link to this post
Mystery solved.  I've been back through versions to 2014 (including that in the EPEL-6 repository) and couldn't find dwcleanup, which surprised me.  I then downloaded some of the plugins, but again it wasn't there - very puzzling.  However https://www.dokuwiki.org/tips:maintenance?s[]=cleanup gives the code at the top of the page.  It will not be in a default installation, but is semi-official code.  I'm having another go at attaching the screenshot.
The author has attached one file to this post:
Screenshot at 2018-10-25 13-28-32.png 20.3 kBytes
You have no permission to open this file.
Avatar
yasBro #14
Member for 2 months · 2 posts
Group memberships: Members
Show profile · Link to this post
In reply to post #2
Quote by MartinR on 2018-10-24, 21:23:
# rm -r <dokuwikibase>/news/*

If you are still using Windows then you can try deleting through Explorer if you're wary of the command line.

Thank you very much, this helped me a lot.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2018-12-16, 07:05:02 (UTC +01:00)