Exemplo n.º 1
0
 /**
  * @param $websiteId
  *
  * @return \Cms\Data\Website
  */
 protected function getWebsite($websiteId)
 {
     return $this->websiteBusiness->getById($websiteId);
 }
Exemplo n.º 2
0
 /**
  * @param  string $websiteId
  * @param  string $comment
  *
  * @return \Cms\Data\Build
  */
 public function buildWebsite($websiteId, $comment)
 {
     $websiteService = new Website('Website');
     if (!$websiteService->existsWebsiteAlready($websiteId)) {
         throw new CmsException('602', __METHOD__, __LINE__);
     }
     $websiteToCreate = $websiteService->getById($websiteId);
     if (!$websiteToCreate->getPublishingEnabled()) {
         throw new CmsException('624', __METHOD__, __LINE__, array('websiteId' => $websiteId));
     }
     $creatorBusiness = new \Cms\Business\Creator('Creator');
     $creatorData = $creatorBusiness->createWebsite($websiteId);
     $this->setLastCreatorData($creatorData);
     $increasedVersion = $websiteService->increaseVersion($websiteId);
     $buildTimestamp = $this->getBuildTimestamp();
     $buildData = new BuildData();
     $buildData->setId($this->getBuildId($increasedVersion, $buildTimestamp))->setVersion($increasedVersion)->setTimestamp($buildTimestamp)->setComment($comment)->setWebsiteId($websiteToCreate->getId())->setWebsiteName($websiteToCreate->getName())->setBuilderVersion(self::VERSION)->setCreatorName($creatorData->getName())->setCreatorVersion($creatorData->getVersion());
     if ($this->storeBuildVersionAsJson($buildData)) {
         $this->createAndAnnotateBuildZip($websiteId, $buildData);
         $this->removeCreatedWebsiteDirectory($websiteId);
     } else {
         $this->removeCreatedWebsiteDirectory($websiteId);
         $exceptionMessage = sprintf("Unable to store build version file in '%s'", $this->getLastCreatorDirectory());
         throw new \Exception($exceptionMessage);
     }
     return $buildData;
 }
Exemplo n.º 3
0
 /**
  * @param $websiteId
  *
  * @return \Cms\Data\Website
  * @throws \Cms\Exception
  */
 private function getWebsiteById($websiteId)
 {
     $websiteBusiness = new WebsiteBusiness('Website');
     return $websiteBusiness->getById($websiteId);
 }