Example #1
0
 private function getConfigToConnectionString()
 {
     $config = BigBrother::getConfig();
     $dbConfig = $config->database;
     $connectionString = (string) $dbConfig->driver . ':host=' . (string) $dbConfig->host . (!empty($dbConfig->port) ? ';port=' . (string) $dbConfig->port : '') . ';dbname=' . (string) $dbConfig->schema;
     return array('string' => $connectionString, 'username' => (string) $dbConfig->username, 'password' => (string) $dbConfig->password);
 }
 public function saveAction(Request $request)
 {
     try {
         BigBrother::updateConfig($request->request->all());
         DbConnection::getInstance()->getConnection();
         BigBrother::saveConfig();
         $installer = new Installer();
         $installer->run();
     } catch (Exception $e) {
         $request->getSession()->set('message', 'Can\'t connect to database. Please try again.');
     }
     return $this->RedirectToRoute('lancer_lance_install');
 }
Example #3
0
 protected function _install($installNode)
 {
     try {
         if (version_compare($installNode->version, $this->config->version) > 0) {
             DbConnection::getInstance()->getConnection()->beginTransaction();
             foreach ($installNode->tasks[0] as $task) {
                 DbConnection::getInstance()->getConnection()->query((string) $task);
             }
             DbConnection::getInstance()->getConnection()->commit();
             $this->config->version = $installNode->version;
             BigBrother::updateConfig($this->config);
         }
     } catch (\Exception $e) {
         DbConnection::getInstance()->getConnection()->rollBack();
         throw new \Exception("Install problems. Please check install content and repeat.");
     }
 }