summaryrefslogtreecommitdiff
path: root/scripts/cleanup_old_posts.php
blob: 6a3986ab0971fec8c5d41a82cdbc39fa050bd311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/php
<?php

/* Foursquare Community Site
 * 
 * Copyright (C) 2011 Foursquare Church.
 * 
 * Developers: Jesse Morgan <jmorgan@foursquarestaff.com>
 *
 */

require_once "../htdocs/src/base.inc.php";

$pi = new PostIterator();

$diff = $CONFIG['expiretime'] * 86400;

$pi->filterCreated(0, time() - $diff);
$pi->query();

$count = 0;
foreach ($pi as $post) {
    $post->delete();
    $count++;

}

// TODO: Add Logging?

?>