Exemple #1
0
 public function create_config(array $data)
 {
     Container::get('hooks')->fire('controller.install.create_config');
     // Generate config ...
     $config = array();
     foreach ($data as $key => $value) {
         if (in_array($key, $this->config_keys)) {
             $config[$key] = $value;
         }
     }
     $config = array_merge($config, array('cookie_name' => mb_strtolower(ForumEnv::get('FORUM_NAME')) . '_cookie_' . Random::key(7, false, true), 'jwt_token' => base64_encode(Random::secure_random_bytes(64)), 'jwt_algorithm' => 'HS512'));
     // ... And write it on disk
     if ($this->write_config($config)) {
         return $this->create_db($data);
     } else {
         // TODO: Translate
         return Router::redirect(Router::pathFor('install'), ['error', 'Error while writing config file']);
     }
 }