getEnvironment() public static method

public static getEnvironment ( ) : string
return string
Example #1
0
 /**
  * @param $documentId
  * @param $config
  * @throws \Exception
  */
 public function preparePdfGeneration($documentId, $config)
 {
     $document = $this->getPrintDocument($documentId);
     if (Model\Tool\TmpStore::get($document->getLockKey())) {
         throw new \Exception("Process with given document alredy running.");
     }
     Model\Tool\TmpStore::add($document->getLockKey(), true);
     $jobConfig = new \stdClass();
     $jobConfig->documentId = $documentId;
     $jobConfig->config = $config;
     $this->saveJobConfigObjectFile($jobConfig);
     $this->updateStatus($documentId, 0, "prepare_pdf_generation");
     $args = ["-p " . $jobConfig->documentId];
     $env = \Pimcore\Config::getEnvironment();
     if ($env !== false) {
         $args[] = "--environment=" . $env;
     }
     $cmd = Tool\Console::getPhpCli() . " " . realpath(PIMCORE_PATH . DIRECTORY_SEPARATOR . "cli" . DIRECTORY_SEPARATOR . "console.php") . " web2print:pdf-creation " . implode(" ", $args);
     Logger::info($cmd);
     if (!$config['disableBackgroundExecution']) {
         Tool\Console::execInBackground($cmd, PIMCORE_LOG_DIRECTORY . DIRECTORY_SEPARATOR . "web2print-output.log");
     } else {
         Processor::getInstance()->startPdfGeneration($jobConfig->documentId);
     }
 }
Example #2
0
 /**
  * @param $script
  * @param $arguments
  * @return string
  */
 protected static function buildPhpScriptCmd($script, $arguments)
 {
     $phpCli = Console::getPhpCli();
     $cmd = $phpCli . " " . $script;
     if (Config::getEnvironment()) {
         $cmd .= " --environment=" . Config::getEnvironment();
     }
     if (!empty($arguments)) {
         $cmd .= " " . $arguments;
     }
     return $cmd;
 }