Example #1
0
 /**
  * Constructor
  *
  * @param Configurator $configurator Configurator service
  * @param string       $kernelRoot   Kernel root path
  * @param RequestStack $requestStack Request stack
  */
 public function __construct(Configurator $configurator, $kernelRoot, RequestStack $requestStack)
 {
     $request = $requestStack->getCurrentRequest();
     $this->configIsWritable = $configurator->isFileWritable();
     $this->kernelRoot = $kernelRoot;
     $this->site_url = $request->getSchemeAndHttpHost() . $request->getBasePath();
 }
Example #2
0
 /**
  * Constructor
  *
  * @param Configurator $configurator
  */
 public function __construct(Configurator $configurator)
 {
     $parameters = $configurator->getParameters();
     foreach ($parameters as $key => $value) {
         if (0 === strpos($key, 'db_')) {
             $parameters[substr($key, 3)] = $value;
             $key = substr($key, 3);
             $this->{$key} = $value;
         }
     }
 }
Example #3
0
 /**
  * @param array|StepInterface $params
  * @param null                $step
  * @param bool                $clearCache
  *
  * @return bool
  */
 protected function saveConfiguration($params, $step = null, $clearCache = false)
 {
     if (null !== $step) {
         $params = $step->update($params);
     }
     $this->configurator->mergeParameters($params);
     try {
         $this->configurator->write();
     } catch (\RuntimeException $exception) {
         return false;
     }
     if ($clearCache) {
         $this->get('mautic.helper.cache')->clearContainerFile(false);
     }
     return true;
 }