summaryrefslogtreecommitdiff
path: root/scripts/cleanup_old_posts.php
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cleanup_old_posts.php')
-rwxr-xr-xscripts/cleanup_old_posts.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/scripts/cleanup_old_posts.php b/scripts/cleanup_old_posts.php
new file mode 100755
index 0000000..6a3986a
--- /dev/null
+++ b/scripts/cleanup_old_posts.php
@@ -0,0 +1,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?
+
+?>