Index: plugins/iaBotControlPlugin/trunk/lib/task/iaBotControlGCTask.class.php =================================================================== --- plugins/iaBotControlPlugin/trunk/lib/task/iaBotControlGCTask.class.php (revision 22074) +++ plugins/iaBotControlPlugin/trunk/lib/task/iaBotControlGCTask.class.php (revision 22074) @@ -0,0 +1,45 @@ + + */ +class iaBotControlGCTask extends sfPluginBaseTask +{ + /** + * @see sfTask + */ + protected function configure() + { + $this->addOption('days', null, sfCommandOption::PARAMETER_OPTIONAL, + 'The days after which non-updated records will be deleted', 10); + + $this->namespace = 'iaBotControl'; + $this->name = 'gc'; + $this->briefDescription = 'Performes garbage collection'; + + $this->detailedDescription = <<configuration); + + $rows = Doctrine_Query::create() + ->delete('iaBotControlRequest r') + ->where('r.updated_at < ?', self::calcDate($options['days'])) + ->execute(); + $this->log($rows.' records deleted which were more than '.$options['days'].' days old'); + } + + private static function calcDate($days_ago) + { + return strtotime('-'.$days_ago.' days'); + } +} Index: plugins/iaBotControlPlugin/trunk/modules/iaBotControl/lib/BaseiaBotControlActions.class.php =================================================================== --- plugins/iaBotControlPlugin/trunk/modules/iaBotControl/lib/BaseiaBotControlActions.class.php (revision 22062) +++ plugins/iaBotControlPlugin/trunk/modules/iaBotControl/lib/BaseiaBotControlActions.class.php (revision 22074) @@ -6,4 +6,5 @@ * @subpackage plugin * @author Sebastian Schulze + * @author Maik Riechert */