Example #1
0
 private function createConnection()
 {
     $connectionMethods = $this->options->getConnectionMethods();
     if (!empty($connectionMethods) && is_array($connectionMethods)) {
         $this->getPreferredConnection($connectionMethods);
         if ($this->connection !== null) {
             return $this->connection;
         }
     }
     if ($this->environment->isPdoEnabled()) {
         $this->connection = new MWP_IncrementalBackup_Database_PdoConnection($this->configuration);
     } elseif ($this->environment->isMysqliEnabled()) {
         $this->connection = new MWP_IncrementalBackup_Database_MysqliConnection($this->configuration);
     } elseif ($this->environment->isMysqlEnabled()) {
         $this->connection = new MWP_IncrementalBackup_Database_MysqlConnection($this->configuration);
     } else {
         throw new MWP_IncrementalBackup_Database_Exception_ConnectionException("No mysql drivers available.");
     }
     return $this->connection;
 }