/** * @return \Spryker\Shared\Application\Communication\Application */ public function boot() { $this->application['debug'] = Config::get(ApplicationConstants::ENABLE_APPLICATION_DEBUG, false); $this->application['locale'] = Store::getInstance()->getCurrentLocale(); if (Config::get(ApplicationConstants::ENABLE_WEB_PROFILER, false)) { $this->application['profiler.cache_dir'] = DataDirectory::getLocalStoreSpecificPath('cache/profiler'); } $this->optimizeApp(); $this->enableHttpMethodParameterOverride(); if ($this->isInternalRequest() && !$this->isAuthenticationEnabled()) { $this->registerServiceProviderForInternalRequest(); return $this->application; } if ($this->isInternalRequest()) { $this->registerServiceProviderForInternalRequestWithAuthentication(); return $this->application; } $this->registerServiceProvider(); $this->addVariablesToTwig(); return $this->application; }
/** * @return string */ protected function getLogPath() { if (!isset($this->options[EventJournalConstants::OPTION_LOG_PATH])) { return DataDirectory::getLocalCommonPath('event_journal'); } return $this->options[EventJournalConstants::OPTION_LOG_PATH]; }
/** * @throws \ErrorException * * @return void */ public function generateAction() { require implode(DIRECTORY_SEPARATOR, [APPLICATION_ROOT_DIR, 'config', 'Zed', 'cronjobs', 'jobs.php']); $jobs_dir = DataDirectory::getLocalCommonPath('/jenkins/jobs/'); $roles = $this->getRoles(); if ($roles === false) { $roles = [self::DEFAULT_ROLE]; } foreach ($roles as $role) { if (!in_array($role, $this->allowedRoles)) { throw new \ErrorException($role . ' is not in the list of allowed roles! Cannot continue configuration of jenkins!'); } } $job_by_name = []; foreach ($jobs as $v) { if (array_key_exists('role', $v) && in_array($v['role'], $this->allowedRoles)) { $jobRole = $v['role']; } else { $jobRole = self::DEFAULT_ROLE; } // Enable jobs only for roles matching those specified via command line argument if (array_search($jobRole, $roles) === false) { continue; } foreach ($v['stores'] as $store) { $name = $store . '__' . $v['name']; $job_by_name[$name] = $v; $job_by_name[$name]['name'] = $name; $job_by_name[$name]['store'] = $store; $job_by_name[$name]['role'] = $jobRole; unset($job_by_name[$name]['stores']); } } // Loop thru existing jobs - either update them or delete them. $existing_jobs = glob($jobs_dir . '*/config.xml'); if (!empty($existing_jobs)) { foreach ($existing_jobs as $v) { $name = basename(dirname($v)); if (array_search($name, array_keys($job_by_name)) === false) { // Job does not exist anymore - we have to delete it. $url = 'job/' . $name . '/doDelete'; $code = $this->callJenkins($url); echo "Delete job: {$url} returned code {$code}\n"; } else { // Job exists - let's update config.xml and remove it from array of jobs $xml = $this->prepareJobXml($job_by_name[$name]); $url = 'job/' . $name . '/config.xml'; $code = $this->callJenkins($url, $xml); unset($job_by_name[$name]); if ($code !== '200') { echo "Update: {$url} returned code {$code}\n"; } } } } // Create new job definitions foreach ($job_by_name as $k => $v) { $xml = $this->prepareJobXml($v); $url = 'createItem?name=' . $v['name']; $code = $this->callJenkins($url, $xml); echo "Jenkins API {$url} returned response: {$code}\n"; } }
/** * @param string $fileName * @param string $dir * * @throws \Exception * * @return string */ public static function getFilePath($fileName, $dir = 'logs') { $logPath = DataDirectory::getLocalStoreSpecificPath($dir); if ($dir === 'logs') { $logPath .= APPLICATION . DIRECTORY_SEPARATOR; if (is_dir($logPath) === false) { mkdir($logPath, 0775, true); } } if (!is_writable($logPath)) { throw new Exception(sprintf('Log file "%s" is not writable!', $logPath)); } return $logPath . DIRECTORY_SEPARATOR . $fileName; }
/** * @return string */ protected function getCacheFilename() { return DataDirectory::getLocalStoreSpecificPath('cache/autoloader') . '/unresolvable.php'; }
/** * @return string */ public function getDestinationDirectoryForUploads() { return DataDirectory::getLocalStoreSpecificPath('import/products'); }
<?php use Spryker\Shared\Application\ApplicationConstants; $config[ApplicationConstants::PROJECT_NAMESPACES] = ['Pyz']; $config[ApplicationConstants::CORE_NAMESPACES] = ['Spryker']; $config[ApplicationConstants::PROJECT_TIMEZONE] = 'UTC'; $config[ApplicationConstants::PROJECT_NAMESPACE] = 'Pyz'; $config[ApplicationConstants::ERROR_LEVEL] = E_ALL; /* Customer */ $config[ApplicationConstants::APPLICATION_SPRYKER_ROOT] = APPLICATION_ROOT_DIR . '/../'; $config[ApplicationConstants::ZED_TWIG_OPTIONS] = ['cache' => \Spryker\Shared\Library\DataDirectory::getLocalStoreSpecificPath('cache/Zed/twig')]; // Why this? $config[ApplicationConstants::YVES_SSL_ENABLED] = false; $config[ApplicationConstants::NAVIGATION_CACHE_ENABLED] = false; $config[ApplicationConstants::NAVIGATION_ENABLED] = false;