private function readPublisherStatusFromCache($websiteId, $buildId) { $publishedStatus = new PublisherStatusData(); $publishedStatus->setStatus(PublisherStatusData::STATUS_UNKNOWN); $publishedInfoFilePath = $this->getPublisherStatusCacheFilePath($websiteId, $buildId); if (file_exists($publishedInfoFilePath)) { $publishedStatus->setFromArray(SbJson::decode(FS::readContentFromFile($publishedInfoFilePath), SbJson::TYPE_ARRAY)); } 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 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; }