*/ class UpdateMonitoringTimeValues implements Action { public function __invoke($params) { $serviceManager = ServiceManager::getServiceManager(); /** @var DeliveryMonitoringService $monitoring */ $monitoring = $serviceManager->get(DeliveryMonitoringService::SERVICE_ID); $data = $monitoring->find(); $executions = 0; foreach ($data as $deliveryData) { try { $deliveryDataArr = $deliveryData->get(); $deliveryData->update( DeliveryMonitoringService::START_TIME, \tao_helpers_Date::getTimeStamp($deliveryDataArr[DeliveryMonitoringService::START_TIME], true) ); $endTime = $deliveryDataArr[DeliveryMonitoringService::END_TIME]; if ($endTime) { $deliveryData->update( DeliveryMonitoringService::END_TIME, \tao_helpers_Date::getTimeStamp($endTime, true) ); } $monitoring->partialSave($deliveryData); $executions++; } catch (\common_exception_NotFound $e) { //Delivery execution not found; Skip } } return new Report( Report::TYPE_INFO, $executions . ' delivery executions updated' ); } }