예제 #1
0
 /**
  * batch setCommandResult action saves the results of a command as recieved from a remote scheduler
  * 
  * @action setCommandResult
  * @param int $commandId The id of the command
  * @param KalturaControlPanelCommandStatus $status The status of the command
  * @param int $timestamp The time that the command performed
  * @param string $errorDescription The description, important for failed commands
  * @return KalturaControlPanelCommand
  */
 function setCommandResultAction($commandId, $status, $errorDescription = null)
 {
     // find the command
     $commandDb = ControlPanelCommandPeer::retrieveByPK($commandId);
     if (!$commandDb) {
         throw new KalturaAPIException(KalturaErrors::COMMAND_NOT_FOUND, $commandId);
     }
     // save the results to the DB
     $commandDb->setStatus($status);
     if (!is_null($errorDescription)) {
         $commandDb->setErrorDescription($errorDescription);
     }
     $commandDb->save();
     // if is config, update the config status
     if ($commandDb->getType() == KalturaControlPanelCommandType::CONFIG) {
         $c = new Criteria();
         $c->add(SchedulerConfigPeer::COMMAND_ID, $commandId);
         $configDb = SchedulerConfigPeer::doSelectOne($c);
         if ($configDb) {
             $configDb->setCommandStatus($status);
             $configDb->save();
         }
     }
     $command = new KalturaControlPanelCommand();
     $command->fromObject($commandDb, $this->getResponseProfile());
     return $command;
 }