Bug#756050: dokuwiki: Doesn't erase the cache nor does other needed maintenance

2014-08-26 Thread Tanguy Ortolo

Rodrigo Campos, 2014-08-26 01:55+0100:

On Mon, Aug 25, 2014 at 05:51:52PM +0200, Tanguy Ortolo wrote:

Given the importance of this modification, and the level of damage
it could do if we made a mistake (it deletes file in a wiki data
directory!), I will upload this revision to experimental: could you
please test it and confirm it does not delete production data? Only
after that will I be able to upload it to unstable.


Sure! I've just tried it and I can confirm it worked fine on my production
system. Let me explain how I tried it, just in case:

I installed the dokuwiki in my local PC, copied the cron file to my server (I've
done a snapshot just before trying this, of course ;) and changed all default
from false to true (so I try all the cases). Oh, and also commented the source
to /etc/default/dokuwiki as that file does not exist on my installation from
stable.


You could have copied /etc/default/dokuwiki that only exists for 
configuring the cron job!



Then run the script and everything went fine.

I didn't test changing the date of the files and verify they are deleted, but
that should work.

I've detected a very simple problem on my local machine, though. The line that
says:

find cache/?/ -type f -mtime +$max_days -delete

fails on a new dokuwiki installation. And it faile because the cache directory
is empty on a brand new installation. Just changing it to:

find cache -type f -mtime +$max_days -delete

works just fine (the /?/ is not really important, as the filter for -type f
is there) because the cache directory is created during the installation.


Correct, I will apply the same.


If you want me to test something else, please let me know :)


That should be enough, I shall upload it to unstable soon. Thank you!

--
 ,--.
: /` )   ن Tanguy Ortoloxmpp:tan...@ortolo.eu
| `-'Debian Developer   irc://irc.oftc.net/Tanguy
 \_


signature.asc
Description: Digital signature


Bug#756050: dokuwiki: Doesn't erase the cache nor does other needed maintenance

2014-08-26 Thread Rodrigo Campos
On Tue, Aug 26, 2014 at 10:07:47AM +0200, Tanguy Ortolo wrote:
 Rodrigo Campos, 2014-08-26 01:55+0100:
 On Mon, Aug 25, 2014 at 05:51:52PM +0200, Tanguy Ortolo wrote:
 Given the importance of this modification, and the level of damage
 it could do if we made a mistake (it deletes file in a wiki data
 directory!), I will upload this revision to experimental: could you
 please test it and confirm it does not delete production data? Only
 after that will I be able to upload it to unstable.
 
 Sure! I've just tried it and I can confirm it worked fine on my production
 system. Let me explain how I tried it, just in case:
 
 I installed the dokuwiki in my local PC, copied the cron file to my server 
 (I've
 done a snapshot just before trying this, of course ;) and changed all default
 from false to true (so I try all the cases). Oh, and also commented the 
 source
 to /etc/default/dokuwiki as that file does not exist on my installation from
 stable.
 
 You could have copied /etc/default/dokuwiki that only exists for
 configuring the cron job!

Yes, but I have to do that, copy it to the correct location, etc. And I was lazy
and defaults should work :-D

 I've detected a very simple problem on my local machine, though. The line 
 that
 says:
 
  find cache/?/ -type f -mtime +$max_days -delete
 
 fails on a new dokuwiki installation. And it faile because the cache 
 directory
 is empty on a brand new installation. Just changing it to:
 
  find cache -type f -mtime +$max_days -delete
 
 works just fine (the /?/ is not really important, as the filter for -type 
 f
 is there) because the cache directory is created during the installation.
 
 Correct, I will apply the same.

Cool :-)

 If you want me to test something else, please let me know :)
 
 That should be enough, I shall upload it to unstable soon. Thank you!

Thank you!

I will modify my cron to be this one that will go to unstable then!




Thanks again,
Rodrigo


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#756050: dokuwiki: Doesn't erase the cache nor does other needed maintenance

2014-08-25 Thread Tanguy Ortolo

Hello,

Rodrigo Campos, 2014-07-25 19:12+0100:

The dokuwiki installation doesn't ever erase the cache. In my installation the
cache was using 750M and the whole data directory, excluding the cache, was 20M.

When looking how to erase the cache, I found this:
https://www.dokuwiki.org/tips:maintenance

Based on that, I did a script to erase the cache and some other stale files that
page recommends. And also update the wordlist. I attach the script just in case
is useful for you.

Please consider fixing this using the script or in some other way.


Thank you for reporting this issue. I used your script as a daily 
crontab script, with some modifications:

* switch to pure /bin/sh;
* use find -delete instead of find | xargs rm;
* make it modular so the user can configure in /etc/default/dokuwiki 
  whether or not to run the cleanup at all (default: yes), after how 
  many days a file is to be considered as old (default: 180), whether or 
  not to remove old revisions (default: NO!), and whether or not to 
  update the spam blacklist (default: no, as it implies importing data 
  from outside, which may or may not be possible or desirable depending 
  on the case).


Given the importance of this modification, and the level of damage it 
could do if we made a mistake (it deletes file in a wiki data 
directory!), I will upload this revision to experimental: could you 
please test it and confirm it does not delete production data? Only 
after that will I be able to upload it to unstable.


Regards,

--
 ,--.
: /` )   ن Tanguy Ortoloxmpp:tan...@ortolo.eu
| `-'Debian Developer   irc://irc.oftc.net/Tanguy
 \_


signature.asc
Description: Digital signature


Bug#756050: dokuwiki: Doesn't erase the cache nor does other needed maintenance

2014-08-25 Thread Rodrigo Campos
On Mon, Aug 25, 2014 at 05:51:52PM +0200, Tanguy Ortolo wrote:
 Hello,
 
 Rodrigo Campos, 2014-07-25 19:12+0100:
 The dokuwiki installation doesn't ever erase the cache. In my installation 
 the
 cache was using 750M and the whole data directory, excluding the cache, was 
 20M.
 
 When looking how to erase the cache, I found this:
 https://www.dokuwiki.org/tips:maintenance
 
 Based on that, I did a script to erase the cache and some other stale files 
 that
 page recommends. And also update the wordlist. I attach the script just in 
 case
 is useful for you.
 
 Please consider fixing this using the script or in some other way.
 
 Thank you for reporting this issue. I used your script as a daily
 crontab script, with some modifications:
 * switch to pure /bin/sh;
 * use find -delete instead of find | xargs rm;
 * make it modular so the user can configure in /etc/default/dokuwiki
 whether or not to run the cleanup at all (default: yes), after how
 many days a file is to be considered as old (default: 180), whether
 or   not to remove old revisions (default: NO!), and whether or not
 to   update the spam blacklist (default: no, as it implies importing
 data   from outside, which may or may not be possible or desirable
 depending   on the case).

Great!

 
 Given the importance of this modification, and the level of damage
 it could do if we made a mistake (it deletes file in a wiki data
 directory!), I will upload this revision to experimental: could you
 please test it and confirm it does not delete production data? Only
 after that will I be able to upload it to unstable.

Sure! I've just tried it and I can confirm it worked fine on my production
system. Let me explain how I tried it, just in case:

I installed the dokuwiki in my local PC, copied the cron file to my server (I've
done a snapshot just before trying this, of course ;) and changed all default
from false to true (so I try all the cases). Oh, and also commented the source
to /etc/default/dokuwiki as that file does not exist on my installation from
stable. Then run the script and everything went fine.

I didn't test changing the date of the files and verify they are deleted, but
that should work.

I've detected a very simple problem on my local machine, though. The line that
says:

find cache/?/ -type f -mtime +$max_days -delete

fails on a new dokuwiki installation. And it faile because the cache directory
is empty on a brand new installation. Just changing it to:

find cache -type f -mtime +$max_days -delete

works just fine (the /?/ is not really important, as the filter for -type f
is there) because the cache directory is created during the installation.


If you want me to test something else, please let me know :)




Thanks a lot,
Rodrigo


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#756050: dokuwiki: Doesn't erase the cache nor does other needed maintenance

2014-07-25 Thread Rodrigo Campos
Package: dokuwiki
Version: 0.0.20120125b-2
Severity: normal

Dear Maintainer,

The dokuwiki installation doesn't ever erase the cache. In my installation the
cache was using 750M and the whole data directory, excluding the cache, was 20M.

When looking how to erase the cache, I found this:
https://www.dokuwiki.org/tips:maintenance

Based on that, I did a script to erase the cache and some other stale files that
page recommends. And also update the wordlist. I attach the script just in case
is useful for you.

Please consider fixing this using the script or in some other way.




Thanks a lot,
Rodrigo
#!/usr/bin/env bash
 
cleanup() {
# $1 ... full path to data directory of wiki
# $2 ... number of days after which old files are to be removed

# purge files older than $2 days from attic and media_attic (old 
revisions)
find $1/{media_,}attic/ -type f -mtime +$2 -print0 | xargs -0r rm -f

# remove stale lock files (files which are 1-2 days old)
find $1/locks/ -name '*.lock' -type f -mtime +1 -print0 | xargs -0r 
rm -f

# remove empty directories
find 
$1/{attic,cache,index,locks,media,media_attic,media_meta,meta,pages,tmp}/ \
  -mindepth 1 -type d -empty -print0 | xargs -0r rmdir

# remove files older than $2 days from the cache
find $1/cache/?/ -type f -mtime +$2 -print0 | xargs -0r rm -f
}
 
cleanup /var/lib/dokuwiki/data 180

curl -s 'http://meta.wikimedia.org/wiki/Spam_blacklist?action=raw' |grep -v 
'pre'  /etc/dokuwiki/wordblock.local.conf