Batch-deleting Posts

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
DrNI
Regular
Posts: 13
Joined: Thu Apr 23, 2009 1:16 pm

Batch-deleting Posts

Post by DrNI »

Hi folks,

do you know this feeling... when your past keeps haunting you like a ghost? :roll:

I want do delete some old posts, identified by their post number. Is there a way to do this automatically?

I know how to use Unix commands and the cmd line mysql client, if that should be needed. Feel free to post nerdy answers. :D

Thanks for your assistance and thanks to all of you making s9y available. Great software.
DrNI
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Batch-deleting Posts

Post by garvinhicking »

Hi!

If you want ot do that, the best way would be to use SQL directly:

DELETE FROM serendipity_entries WHERE id IN (4,8,15,16,23,42)

This leaves some corpses of data in the database, but that should not really be relevant.

Of course, the cleaner way would be a script like:

Code: Select all

<?php
include 'serendipity_config.inc.php';
serendipity_deleteEntry(4);

serendipity_deleteEntry(8);

serendipity_deleteEntry(15);
...
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DrNI
Regular
Posts: 13
Joined: Thu Apr 23, 2009 1:16 pm

Re: Batch-deleting Posts

Post by DrNI »

Hi Garvin et al,

it's deletion day again, but somehow this doesn't work any more:

Code: Select all

<?php
include 'serendipity_config.inc.php';
serendipity_deleteEntry(4);

serendipity_deleteEntry(8);

serendipity_deleteEntry(15);
...
Nothing happens, the log remains silent, except for a nice 200 OK line in the access log.

Are there changes to the s9y code that make this solution not work?

Thanks for your help

DrNI
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Batch-deleting Posts

Post by garvinhicking »

Hi!

Which s9y version? Also, are you logged in before you call the PHP script? It needs authentication.

Regards,
GArvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DrNI
Regular
Posts: 13
Joined: Thu Apr 23, 2009 1:16 pm

Re: Batch-deleting Posts

Post by DrNI »

Hi Garvin,
garvinhicking wrote: Which s9y version? Also, are you logged in before you call the PHP script? It needs authentication.
I could have guessed that. Did it again after login and of course it worked. Thanks for your help.

DrNI
Post Reply