Page 1 of 1

Pruning Old Posts

Posted: Wed Oct 11, 2006 9:39 pm
by Brian1969
Is there an easy way to go back and prune old, outdated posts in Serendipity? Say like have it auto-delete posts over x-amount of days old (I'm thinking around a year ago)?

Re: Pruning Old Posts

Posted: Wed Oct 11, 2006 10:58 pm
by garvinhicking
Hi!

There's an event plugin serendipity_event_outdate_entries that you can use to purge old entries.

However of course that is not the way a weblog usually works *g*

Best regards,
Garvin

Posted: Wed Oct 11, 2006 11:00 pm
by Brian1969
Yeah, I know.

The reason I want to get rid of some stuff is because I'm approaching the limits on my server, and my first year of blogging was pretty much a non-event. lol

Posted: Wed Oct 11, 2006 11:07 pm
by Brian1969
Uhm....where would I find this plug-in? Because I'm not seeing it anywhere....

Posted: Wed Oct 11, 2006 11:35 pm
by garvinhicking
Hi!

The name is "Hide entries for non-registered users". Now that I read the description, I see that it does not completely do what you wanted. :)

Thus you might need to modify that plugin to delete entries instead of "hiding" them? Or you just manually delete old entries? Dunno. :)

Best regards,
Garvin

Posted: Wed Oct 11, 2006 11:41 pm
by Brian1969
Nope, that's not what I needed. It's close, though. =D

Any idea how I could modify it to delete instead of hide? I don't know PHP or anything like that, so I'd be very hard-pressed to try anything with it.

Posted: Wed Oct 11, 2006 11:47 pm
by garvinhicking
Hi!

Modifying the PHP code would take me some time - have you thought about just using phpMyAdmin to quickly delete more entries?

DELETE FROM serendipity_entries WHERE timestamp < (UNIX_TIMESTAMP(NOW()) - 86400*360)

would delete all entries older than one year from the current timestamp onwards...

Best regards,
Garvin

Posted: Wed Oct 11, 2006 11:50 pm
by Brian1969
Yes, I started to do that, and I can still go ahead. But I thought it might be easier to see if there was something that would do it automatically for me.

I know a lot of other CMS' have something that allows admins to prune posts and stuff, I thought it might be a neat feature to have.

Not a huge deal, though, I can go through and do it manually. =D

Posted: Wed Oct 11, 2006 11:54 pm
by Brian1969
One more question, if I may.

What would I edit to have the blog redirect readers from the deleted posts to the front page (index page)?

Posted: Thu Oct 12, 2006 3:09 am
by judebert
Nothing. 8)

If you use mod_rewrite, everything not found redirects to the frontpage. If you don't use mod_rewrite, index.php?<whatever> will redirect to the frontpage if it's not found.

Posted: Thu Oct 12, 2006 3:28 am
by Brian1969
Ok, where would I find that setting then?

Posted: Thu Oct 12, 2006 3:43 am
by judebert
Ermm... since you don't have to do anything, you don't have to touch the setting.
If you don't use mod_rewrite, index.php?<whatever> will redirect to the frontpage if it's not found.
If you want to change it anyway, it's in the Admin page under Configure.

Posted: Thu Oct 12, 2006 3:49 am
by Brian1969
Well, right now it just gives a page that says "post not found" or something like that. Mind you, it's not the 404 generic error that says "page not found", it still shows a page on my blog.

But I know that in the past if I deleted something, and then tried to go to that post, it would redirect me to the front page. Since I last updated, it doesn't do that anymore.

So, my question is, how do I get it to do that again?

Posted: Thu Oct 12, 2006 3:51 pm
by judebert
Okay; sorry, I didn't realize it was functioning this way. It's probably because a post ID was actually found in the URL, leading us to actually mention there was a problem. I think this was part of the SEO effort: if two different URLs point to the same thing, they get ranked low. So we made incorrect posts point to an error page, so the main page doesn't get down-ranked.

I'm betting this will require a change in the core code. I can't promise to look into it at this moment, but you're next on my list. (Others are welcome to fix it instead, of course.) If nobody gets it in about a week, I've forgotten despite my PDA. Bump this topic then to kick me in the butt.