/** * @param string $websiteId * @param string $publishingId * @param array $publishConfig * @param array $serviceUrls * * @return \Cms\Data\PublisherStatus * @throws \Cms\Exception */ protected function getStatusImplementations($websiteId, $publishingId, $publishConfig, $serviceUrls) { // return always finished $publishedStatus = new PublisherStatusData(); $publishedStatus->setId($publishingId); $publishedStatus->setStatus(PublisherStatusData::STATUS_FINISHED); $publishedStatus->setTimestamp(time()); return $publishedStatus; }
/** * @param string $websiteId * @param string $publishingId * @param array $publishConfig * @param array $serviceUrls * @throws \Cms\Publisher\PublisherException * @return \Cms\Data\PublisherStatus */ public function getStatusImplementations($websiteId, $publishingId, $publishConfig, $serviceUrls) { $params = $this->getServiceParams($websiteId, $publishConfig, $serviceUrls, array()); $responseBody = null; if ($this->callService(self::ACTION_STATUS, $params, $responseBody) != 200) { throw new PublisherException("error calling external service"); } $publishedStatus = new PublisherStatusData(); $publishedStatus->setFromArray(SbJson::decode($responseBody, SbJson::TYPE_ARRAY)); $publishedStatus->setId($publishingId); return $publishedStatus; }
/** * @param string $websiteId * @param \Cms\Data\PublisherStatus $publishedStatus */ private function removingPublishingFilesOnSpecialStates($websiteId, $publishedStatus) { $deletePublishingFileOnStatus = array(PublisherStatusData::STATUS_FINISHED, PublisherStatusData::STATUS_FAILED); if (in_array($publishedStatus->getStatus(), $deletePublishingFileOnStatus)) { $this->removingPublishingFiles($websiteId, $publishedStatus->getId()); } }
/** * @param Cms\Data\PublisherStatus $publishedStatus */ protected function setValuesFromData(Data\PublisherStatus $publishedStatus) { $this->setId($publishedStatus->getId()); $this->setStatus($publishedStatus->getStatus()); $this->setTimestamp($publishedStatus->getTimestamp()); $this->setPercent($publishedStatus->getPercent()); $this->setRemaining($publishedStatus->getRemaining()); $this->setMsg($publishedStatus->getMsg()); }
/** * @param array $values * * @return $this */ public function setFromArray($values) { $this->clear(); if (isset($values['id'])) { $this->setId($values['id']); } if (isset($values['comment'])) { $this->setComment($values['comment']); } if (isset($values['timestamp'])) { $this->setTimestamp($values['timestamp']); } if (isset($values['version'])) { $this->setVersion($values['version']); } if (isset($values['builder'])) { if (isset($values['builder']['version'])) { $this->setBuilderVersion($values['builder']['version']); } } if (isset($values['creator'])) { if (isset($values['creator']['name'])) { $this->setCreatorName($values['creator']['name']); } if (isset($values['creator']['version'])) { $this->setCreatorVersion($values['creator']['version']); } } if (isset($values['website'])) { if (isset($values['website']['id'])) { $this->setWebsiteId($values['website']['id']); } if (isset($values['website']['name'])) { $this->setWebsiteName($values['website']['name']); } } if (isset($values['lastPublished'])) { $lastPublished = new PublisherStatusData(); $this->setLastPublished($lastPublished->setFromArray($values['lastPublished'])); } return $this; }