Beispiel #1
0
 /**
  * If a config option with the keyname exists then return the value
  * doing any variable substitution first
  *
  * @param string $keyname eg synergy:webproject:template_dir
  *
  * @return bool|mixed
  */
 public function getOption($keyname)
 {
     return $this->project->getOption($keyname);
 }
Beispiel #2
0
 /**
  * Instantiate a new CliProject object
  *
  * @param null  $request the action request notation
  * @param array $parameters parameters to pass to the action
  *
  * @throws SynergyException
  */
 public function __construct($request = null, array $parameters = array())
 {
     register_tick_function(array(&$this, "checkExit"));
     // Check this is coming from the CLI
     if (PHP_SAPI !== 'cli') {
         throw new SynergyException(sprintf('%s must be run from command line project', __CLASS__));
     }
     // Store or build the request
     $this->parameters = $parameters;
     if (!is_null($request)) {
         $this->request = $request;
     } else {
         $this->args = ArgumentParser::parseArguments();
         $this->request = $this->args->getRequest();
     }
     Logger::debug('CliProject started (pid=' . getmypid() . ')');
     if (is_null($this->args->getRequest())) {
         Logger::emergency('No controller request provided');
         exit(1);
     }
     $this->registerSignalHandler();
     if ($this->args->arg('app')) {
         $this->setAppDir($this->args->arg('app'));
     }
     if ($this->args->arg('conf')) {
         $this->setConfigFilename($this->args->arg('conf'));
     }
     parent::__construct();
 }
Beispiel #3
0
 /**
  * Replaces any variable tags (eg %app_dir%) in the value
  *
  * @param string $option_value look for variables to substitute in this string
  *
  * @return string
  */
 protected function replaceOptionVariables($option_value)
 {
     if (isset($this->templateDir)) {
         $option_value = preg_replace('/%template_dir%/', $this->templateDir, $option_value);
     }
     // run any parent substitutions
     $option_value = parent::replaceOptionVariables($option_value);
     return $option_value;
 }