cvs: pearweb /cron trackback-cleanup.php /include pear-config.php

From: Date: Tue, 07 Feb 2006 07:51:45 +0000
Subject: cvs: pearweb /cron trackback-cleanup.php /include pear-config.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-cvs+get-38028@lists.php.net to get a copy of this message
toby Tue Feb 7 07:51:45 2006 UTC Added files: /pearweb/cron trackback-cleanup.php Modified files: /pearweb/include pear-config.php Log: * Added auto purging cron for trackbacks. # Please someone activate that on a daily/weekly basis. http://cvs.php.net/viewcvs.cgi/pearweb/include/pear-config.php?r1=1.35&r2=1.36&diff_format=u Index: pearweb/include/pear-config.php diff -u pearweb/include/pear-config.php:1.35 pearweb/include/pear-config.php:1.36 --- pearweb/include/pear-config.php:1.35 Tue Feb 7 07:38:16 2006 +++ pearweb/include/pear-config.php Tue Feb 7 07:51:45 2006 @@ -14,7 +14,7 @@ * @category pearweb * @copyright Copyright (c) 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License - * @version $Id: pear-config.php,v 1.35 2006/02/07 07:38:16 toby Exp $ + * @version $Id: pear-config.php,v 1.36 2006/02/07 07:51:45 toby Exp $ */ if (isset($_ENV['PEAR_CHANNELNAME'])) { @@ -348,5 +348,9 @@ * Timespan for above defined repost count. 3600 == 30 mins */ define('TRACKBACK_REPOST_TIMESPAN', 3600); +/** + * Auto purging time for trackbacks (14 days). + */ +define('TRACKBACK_PURGE_TIME', 14 * 27 * 60 * 60); ?> http://cvs.php.net/viewcvs.cgi/pearweb/cron/trackback-cleanup.php?view=markup&rev=1.1 Index: pearweb/cron/trackback-cleanup.php +++ pearweb/cron/trackback-cleanup.php <?php /** * Automated cleanup of trackbacks that have not been approved within a certain * timespan. * * @category pearweb * @package PEPr * @author Tobias Schlitt <toby@php.net> * @copyright Copyright (c) 1997-2005 The PHP Group * @license http://www.php.net/license/3_0.txt PHP License * @version $Id: trackback-cleanup.php,v 1.1 2006/02/07 07:51:45 toby Exp $ */ ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/usr/local/www/pearweb/include'); /** * Get common settings. */ require_once 'pear-config.php'; /** * Obtain the system's common functions and classes. */ require_once 'pear-database.php'; /** * Get the database class. */ require_once 'DB.php'; $options = array( 'persistent' => false, 'portability' => DB_PORTABILITY_ALL, ); $dbh =& DB::connect(PEAR_DATABASE_DSN, $options); if (DB::isError($dbh)) { die ("Failed to connect: $dsn\n"); } $sql = 'DELETE FROM trackbacks WHERE timestamp <= '.(time() - TRACKBACK_PURGE_TIME).' AND approved = "false"'; if (PEAR::isError($res = $dbh->query($sql))) { die("SQL <$sql> returned error: <{$res->getMessage()}>.\n"); } ?>

« previous php.pear.cvs (#38028) next »