Beispiel #1
0
 public static function create($module, $description = '', $connection = NULL)
 {
     if (self::isEnabled($module)) {
         return TRUE;
     }
     if (is_null($connection)) {
         $connection = array();
     }
     $defaults = Kohana::config('database.default.connection');
     $odbc = new Odbc();
     // Put our defaults in first
     $odbc->fromArray($defaults);
     // Clobber our defaults (intentionally) with user settings, if any
     $odbc->fromArray($connection);
     /* look up the port by type since its a required field. */
     $odbc->port = self::lookupPort($odbc->type);
     $odbc->dsn_name = 'bluebox';
     $odbc->module = $module;
     $odbc->xpath = $xpath;
     $odbc->description = $description;
     $odbc->enabled = TRUE;
     try {
         $odbc->save();
     } catch (Doctrine_Validator_Exception $e) {
         // will never get here
     }
     return TRUE;
 }
Beispiel #2
0
 public function postInstall()
 {
     // Add the relevant database settings to a new ODBC config automagically
     // TODO: Generate odbc.ini, too?
     $installSamples = Session::instance()->get('installer.samples', FALSE);
     if (empty($installSamples)) {
         return TRUE;
     }
     $odbc = new Odbc();
     $odbc->dsn_name = 'Bluebox';
     $odbc->database = $_SESSION['installer.dbName'];
     $odbc->user = $_SESSION['installer.dbUserName'];
     $odbc->pass = $_SESSION['installer.dbUserPwd'];
     $odbc->host = $_SESSION['installer.dbHostName'];
     $odbc->port = (int) $_SESSION['installer.dbPortSelection'];
     $odbc->type = $_SESSION['installer.dbType'];
     $odbc->description = 'Default FreeSWITCH ODBC Connection';
     $odbc->save();
 }