protected function assertNoGroupsExists() { $websiteBusiness = new WebsiteBusiness('Website'); $groupBusiness = new GroupBusiness('Group'); $websites = $websiteBusiness->getAll(); foreach ($websites as $website) { $groups = $groupBusiness->getAllByWebsiteId($website->getId()); $this->assertInternalType('array', $groups); $this->assertEquals(0, count($groups)); } }
/** * @param \Seitenbau\Logger\SegmentIoStats $sio * @param $tracking_id * * @return array * @throws \Exception */ protected function addCalculatedStats($sio, $tracking_id) { $allUsers = $this->userBusiness->getAll(); $allWebsites = $this->websiteBusiness->getAll(); $numOfWebsites = count($allWebsites); list($numPublishData, $numWebsitesOnceSuccessfullyPublished, $publishedWebsitesUrl) = $this->collectPublishStats($allWebsites); $usedModuleIds = $this->getUsedModuleIds($allWebsites); $calculated_stats = array('diskUsage' => round(DiskUsageHelper::getDiskUsage() / 1024, 2), 'usedWebsites' => $numOfWebsites, 'publishingEnabledWebsites' => $numPublishData, 'publishedWebsites' => $numWebsitesOnceSuccessfullyPublished, 'publishedWebsitesInternalUrl' => $publishedWebsitesUrl['internal'], 'publishedWebsitesExternalUrl' => $publishedWebsitesUrl['external'], 'totalUsers' => count($allUsers), 'usedModuleIds' => $usedModuleIds); $sio->addProperties($tracking_id, $calculated_stats); return $calculated_stats; }
/** * @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; }
/** * @param $websiteId * * @return \Cms\Data\Website */ protected function getWebsite($websiteId) { return $this->websiteBusiness->getById($websiteId); }
/** * @param $websiteId * * @return \Cms\Data\Website * @throws \Cms\Exception */ private function getWebsiteById($websiteId) { $websiteBusiness = new WebsiteBusiness('Website'); return $websiteBusiness->getById($websiteId); }