diff --git a/application/clicommands/CoreCommand.php b/application/clicommands/CoreCommand.php new file mode 100644 index 00000000..4927aa5c --- /dev/null +++ b/application/clicommands/CoreCommand.php @@ -0,0 +1,16 @@ +api()->getConstants() as $name => $value) { + printf("const %s = %s\n", $name, PlainObjectRenderer::render($value)); + } + } +} diff --git a/library/Director/Core/CoreApi.php b/library/Director/Core/CoreApi.php index 979a89ee..4178cfd6 100644 --- a/library/Director/Core/CoreApi.php +++ b/library/Director/Core/CoreApi.php @@ -116,16 +116,21 @@ for (k => v in globals) { constants '; - foreach ($this->client->post( - 'console/execute-script', - array('command' => $command) - )->getSingleResult() as $row) { + foreach ($this->runConsoleCommand($command)->getSingleResult() as $row) { $constants[$row->name] = $row->value; } return $constants; } + protected function runConsoleCommand($command) + { + return $this->client->post( + 'console/execute-script', + array('command' => $command) + ); + } + public function getConstant($name) { $constants = $this->getConstants();