/** * @deprecated Will be removed. Needs refactoring to use Zed getMode(). * * @return string */ public function getMode() { if (Environment::isNotProduction()) { return self::MODE_TEST; } return self::MODE_LIVE; }
/** * @param string|null $environment * * @return void */ public static function init($environment = null) { if ($environment === null) { $environment = Environment::getInstance()->getEnvironment(); } $storeName = Store::getInstance()->getStoreName(); $config = new \ArrayObject(); /* * e.g. config_default.php */ self::buildConfig('default', $config); /* * e.g. config_default-production.php */ self::buildConfig('default-' . $environment, $config); /* * e.g. config_default_DE.php */ self::buildConfig('default_' . $storeName, $config); /* * e.g. config_default-production_DE.php */ self::buildConfig('default-' . $environment . '_' . $storeName, $config); /* * e.g. config_local_test.php */ self::buildConfig('local_test', $config); /* * e.g. config_local.php */ self::buildConfig('local', $config); /* * e.g. config_local_DE.php */ self::buildConfig('local_' . $storeName, $config); /* * e.g. config_propel.php */ self::buildConfig('propel', $config); self::$config = $config; }
/** * @param \Generated\Shared\Transfer\InvoiceTransfer $invoiceTransfer * * @throws \Propel\Runtime\Exception\PropelException * @return \Generated\Shared\Transfer\InvoiceTransfer */ public function writeInvoice(InvoiceTransfer $invoiceTransfer) { $connection = $this->queryContainer->getConnection(); try { $connection->beginTransaction(); $this->writeAddress($invoiceTransfer); $this->persistInvoice($invoiceTransfer); $this->writeInvoiceTaxItems($invoiceTransfer); $this->writeInvoiceItems($invoiceTransfer); $this->writeInvoiceDiscounts($invoiceTransfer); $this->writeInvoiceExpenses($invoiceTransfer); $connection->commit(); } catch (PropelException $exception) { $connection->rollBack(); ErrorLogger::log($exception); if (Environment::isDevelopment()) { throw $exception; } } return $invoiceTransfer; }
/** * @return array */ public function indexAction() { $developmentLinks = []; if (APPLICATION_ENV !== 'production') { $developmentLinks[] = ['href' => '/setup/transfer/repeat', 'target' => '_blank', 'label' => 'Repeat last Yves-request']; $developmentLinks[] = ['href' => '/glossary/dump', 'target' => '_blank', 'label' => 'Dump glossary data to file']; } $developmentLinks[] = ['href' => '/setup/phpinfo', 'target' => '_blank', 'label' => 'Show PHP-Info']; if (Environment::isNotDevelopment()) { $developmentLinks[] = ['href' => '#', 'label' => 'Show Elasticsearch' . ' <span class="icon-info"></span>', 'extras' => ['data-toggle' => 'modal', 'data-target' => '#elastic']]; } else { $developmentLinks[] = ['href' => 'http://' . Config::get(ApplicationConstants::HOST_ZED_GUI) . ':9200', 'target' => '_blank', 'label' => 'Show Elasticsearch']; } if (Environment::isNotDevelopment()) { $developmentLinks[] = ['href' => '#', 'label' => 'Show Elasticsearch Head (9200/_plugin/head)' . ' <span class="icon-info"></span>', 'extras' => ['data-toggle' => 'modal', 'data-target' => '#elasticHead']]; } else { $developmentLinks[] = ['href' => 'http://' . Config::get(ApplicationConstants::HOST_ZED_GUI) . ':9200/_plugin/head', 'target' => '_blank', 'label' => 'Show Elasticsearch Head']; } if (Environment::isNotDevelopment()) { $developmentLinks[] = ['href' => '#', 'label' => 'Show Elasticsearch Bigdesk (9200/_plugin/bigdesk)' . ' <span class="icon-info"></span>', 'extras' => ['data-toggle' => 'modal', 'data-target' => '#elasticBigdeskModal']]; } else { $developmentLinks[] = ['href' => 'http://' . Config::get(ApplicationConstants::HOST_ZED_GUI) . ':9200/_plugin/bigdesk', 'target' => '_blank', 'label' => 'Show Elasticsearch Bigdesk']; } if (Environment::isNotDevelopment()) { $developmentLinks[] = ['href' => '#', 'label' => 'Show Couchbase' . ' <span class="icon-info"></span>', 'extras' => ['data-toggle' => 'modal', 'data-target' => '#couchbaseModal']]; } else { $developmentLinks[] = ['href' => 'http://' . Config::get(ApplicationConstants::HOST_ZED_GUI) . ':8091', 'target' => '_blank', 'label' => 'Show Couchbase']; } if (Environment::isNotDevelopment()) { $developmentLinks[] = ['href' => '#', 'label' => 'Show Jenkins' . ' <span class="icon-info"></span>', 'extras' => ['data-toggle' => 'modal', 'data-target' => '#jenkinsModal']]; } else { $developmentLinks[] = ['href' => Config::get(ApplicationConstants::JENKINS_BASE_URL), 'target' => '_blank', 'label' => 'Jenkins']; } $developmentLinks[] = ['href' => 'URL IS MISSING', 'target' => '_blank', 'label' => 'Install / Update Cronjobs']; return $this->viewResponse(['developmentLinks' => $developmentLinks]); }
/** * @param string $command * @param string $store * * @return string */ protected function getCommand($command, $store) { $environment = Environment::getInstance(); $environment_name = $environment->getEnvironment(); if ($environment->isNotDevelopment()) { return "<command>[ -f ../../../../../../../current/deploy/vars ] && . ../../../../../../../current/deploy/vars\n[ -f ../../../../../../current/deploy/vars ] && . ../../../../../../current/deploy/vars\n[ -f ../../../../../current/deploy/vars ] && . ../../../../../current/deploy/vars\nexport APPLICATION_ENV={$environment_name}\nexport APPLICATION_STORE={$store}\ncd \$destination_release_dir\n. ./config/Zed/cronjobs/cron.conf\n{$command}</command>"; } return "<command>\nexport APPLICATION_ENV={$environment_name}\nexport APPLICATION_STORE={$store}\ncd /data/shop/development/current\n. ./config/Zed/cronjobs/cron.conf\n{$command}</command>"; }
/** * @param string $sessionId * @param string $sessionData * * @return bool */ public function write($sessionId, $sessionData) { $key = $this->keyPrefix . $sessionId; if (strlen($sessionData) < 1) { return false; } $startTime = microtime(true); $environment = Environment::getInstance()->getEnvironment(); $data = json_encode($sessionData); $expireTimestamp = time() + $this->lifetime; $expires = date('Y-m-d H:i:s', $expireTimestamp); $storeName = Store::getInstance()->getStoreName(); $timestamp = date('Y-m-d H:i:s', time()); $query = 'REPLACE INTO session (session.key, session.value, session.store, session.environment, session.expires, session.updated_at) VALUES (?,?,?,?,?,?)'; $statement = $this->connection->prepare($query); $result = $statement->execute([$key, $data, $storeName, $environment, $expires, $timestamp]); $this->newRelicApi->addCustomMetric(self::METRIC_SESSION_WRITE_TIME, microtime(true) - $startTime); return $result; }
/** * @return string */ protected function getBucketName() { $storeName = Store::getInstance()->getStoreName(); $environment = Environment::getInstance()->getEnvironment(); return $storeName . '_' . $environment . '_' . self::BUCKET_NAME_POSTFIX; }