Example #1
0
 /**
  * @return bool
  */
 protected function install()
 {
     if ($this->writeConfig($this->_configFile)) {
         // Disable max script exec time, because creating database shema takes some time
         set_time_limit(0);
         include_once $this->_configFile;
         $this->serviceLocator->set('db.options', ['driver' => DB_DRIVER, 'user' => DB_USER, 'password' => DB_PASS, 'host' => DB_HOST, 'dbname' => DB_NAME, 'charset' => DB_CHARSET]);
         $this->cache->clearAll();
         $this->db->connect()->getSchemaTool()->dropDatabase();
         $this->db->createSchema();
         if (($errors = $this->initConfigurations()) !== true) {
             unlink($this->_configFile);
             $this->view->assign('error', implode('<br />', $errors));
             return false;
         }
         return true;
     }
     return false;
 }