0); protected $taskTypeCode = TaskTypeCodesCodes::NOTIFICATIONCLEANER; public function mainDescription() { return 'Notification Cleaner'; } public function main($params) { $this->setStatus(task\TaskStatusEnum::IN_PROGRESS); LogHelper::addSuccessLog($this->mainDescription().' ', 'Cron '.$this->mainDescription().' Started'); $older_than = GlobalSettingHelper::getSetting(GlobalSettingEnum::DELETE_NOTIFICATIONS_OLDER_THAN); $date = date('Y-m-d H:i:s', strtotime("-$older_than days")); $rep = new notification\Repository(); $rep->setFilter(0, array( 'customQuery' => '`date` < :date ', 'params' => array('date' => $date), )); $notCount = $rep->count(); $rep->delete(); $notificationCountWord = $notCount == 1 ? 'Notification' : 'Notifications'; LogHelper::addSuccessLog($this->mainDescription().' ', 'End Of Cron '.$this->mainDescription().' Run - '.$notCount.' '.$notificationCountWord.' Deleted'); } }