t('Threshold age in hours')); } /** * Get the required parameter for the event * * @access public * @return string[] */ public function getEventRequiredParameters() { return array('project_id'); } /** * Execute the action * * @access public * @param array $data Event data dictionary * @return bool True if the action was executed or false when not executed */ public function doAction(array $data) { $result = true; $threshold = $this->getParam('age') * 3600; foreach ($this->taskFinderModel->getAll($data['project_id'], TaskModel::STATUS_CLOSED) as $task) { $closed_age = time() - $task['date_completed']; if ($closed_age > $threshold) { $result = $this->taskModel->remove($task['id']) && $result; } } return $result; } /** * Check if the event data meet the action condition * * @access public * @param array $data Event data dictionary * @return bool */ public function hasRequiredCondition(array $data) { return true; } }