Exemplo n.º 1
0
 public function handler()
 {
     $sourceStep = $this->getSourceStep();
     $newDbConfigData = $sourceStep ? $sourceStep->getData() : $this->getData();
     $configSampleFilePath = $this->getOption('configSampleFilePath');
     $configFilePath = $this->getOption('configFilePath');
     $dbConfig = (require $configSampleFilePath);
     $dbConfig['connections']['mysql'] = array_merge($dbConfig['connections']['mysql'], $newDbConfigData);
     $configVarString = var_export($dbConfig, true);
     $configFileContentView = View::make(Installer::view('steps.dbConfigFile'))->with(['configVarString' => $configVarString]);
     $newConfigFileContent = "<?php \n" . $configFileContentView->render();
     //die($newConfigFileContent);
     try {
         if (file_put_contents($configFilePath, $newConfigFileContent)) {
             return true;
         } else {
             throw new \Exception();
         }
     } catch (\Exception $e) {
         $this->errors[] = ['title' => 'Error writing database config file', 'message' => $e->getMessage()];
     }
     if ($this->hasError()) {
         $this->renderErrorView();
         return false;
     }
 }
Exemplo n.º 2
0
 public function process()
 {
     $this->isComplete = true;
     $options = $this->getOptions();
     $proceedUrl = isset($options['proceedUrl']) ? $options['proceedUrl'] : null;
     $proceedUrlText = isset($options['proceedUrlText']) ? $options['proceedUrlText'] : null;
     $finishView = \View::make(Installer::view('finish'))->with(['proceedUrl' => $proceedUrl, 'proceedUrlText' => $proceedUrlText]);
     return $finishView->render();
 }
Exemplo n.º 3
0
 public function process($prevStep)
 {
     if (!$this->hasPassed()) {
         $this->wait();
     }
     $fieldsSchema = $this->getFieldsSchema();
     $output = View::make(Installer::view('steps.inputStep'))->with(['step' => $this, 'fieldsSchema' => $fieldsSchema])->render();
     $this->setOutput($output);
     return $output;
 }
Exemplo n.º 4
0
 public function renderErrorView()
 {
     $errorView = View::make(Installer::view('steps.errors'))->with(['step' => $this]);
     $this->setOutput($errorView->render());
 }