CVS update: /cowiki/htdocs/setup/class/task/

[email protected] 8 May 2005 01:01:39 -0000
Newsgroups gmane.comp.php.cowiki.cvs
Message-ID <[email protected]>
User: dgorski 
Date: 2005/05/07 18:01:39

Modified:
   cowiki/htdocs/setup/class/task/class.TaskDocumentStorageConnector.php

Log:
 "postgres" -> "postgresql"

File Changes:

Directory: /cowiki/htdocs/setup/class/task/
===========================================

File [changed]: class.TaskDocumentStorageConnector.php
Url: http://cowiki.tigris.org/source/browse/cowiki/htdocs/setup/class/task/class.TaskDocumentStorageConnector.php?r1=1.3&r2=1.4
Delta lines:  +28 -23
---------------------
--- class.TaskDocumentStorageConnector.php	6 May 2005 02:14:09 -0000	1.3
+++ class.TaskDocumentStorageConnector.php	8 May 2005 01:01:37 -0000	1.4
@@ -2,7 +2,7 @@
 
 /**
  *
- * $Id: class.TaskDocumentStorageConnector.php,v 1.3 2005/05/06 02:14:09 dgorski Exp $
+ * $Id: class.TaskDocumentStorageConnector.php,v 1.4 2005/05/08 01:01:37 dgorski Exp $
  *
  * This file is part of coWiki. coWiki is free software under the terms of
  * the GNU General Public License (GPL). Read the LICENSE file. If you did
@@ -17,7 +17,7 @@
  * @author      Daniel T. Gorski, <[email protected]>
  * @copyright   (C) Daniel T. Gorski, {@link http://www.develnet.org}
  * @license     http://www.gnu.org/licenses/gpl.html
- * @version     $Revision: 1.3 $
+ * @version     $Revision: 1.4 $
  *
  */
 
@@ -34,7 +34,7 @@
 
     const MYSQL_REQUIRED_VERSION    = '4.0.0';
     const MYSQLI_REQUIRED_VERSION   = '4.1.0';
-    const POSTGRES_REQUIRED_VERSION = '7.4.5';
+    const POSTGRESQL_REQUIRED_VERSION   = '7.4.5';
     const SQLITE_REQUIRED_VERSION   = '3.2.0';
 
     private
@@ -268,12 +268,12 @@
     private function checkDBConnection() {
 
         try {
-            $sDSN = $this->State->mustCreateNewDocumentDatabase()
+            $sResource = $this->State->mustCreateNewDocumentDatabase()
                         ? $this->State->getDocumentStorageRootDSN()
                         : $this->State->getDocumentStorageDSN();
 
             $Storage = StorageFactory::getInstance()
-                          ->createDocumentStorage($sDSN);
+                          ->createDocumentStorage($sResource);
 
         // Do we have basically the capability to access this database?
         } catch (StorageApiException $sae) {
@@ -300,6 +300,7 @@
         // Required version dummy
         $sReqVersion = 'unknown';
 
+        // Check name, _not_ scheme, e.g. MySQL, MySQLi, PostgreSQL, SQLite
         switch (strtolower($sName)) {
             case 'mysql':
                 $sReqVersion = self::MYSQL_REQUIRED_VERSION;
@@ -309,8 +310,8 @@
                 $sReqVersion = self::MYSQLI_REQUIRED_VERSION;
                 break;
 
-            case 'postgres':
-                $sReqVersion = self::POSTGRES_REQUIRED_VERSION;
+            case 'postgresql':
+                $sReqVersion = self::POSTGRESQL_REQUIRED_VERSION;
                 break;
 
             case 'sqlite':
@@ -343,21 +344,25 @@
 
         // Check the user privileges/permissions
         switch (strtolower($sName)) {
-            case 'mysql':
-            case 'mysqli':
-                return $this->checkMySqlUserPrivileges($Storage);
+
+            case 'mysql':     // Make it work with deprecated settings
+            case 'mysqli':    // Make it work with deprecated settings
+
+            case 'mysql+innodb':
+            case 'mysqli+innodb':
+                return $this->checkMySQLUserPrivileges($Storage);
                 break;
 
-            case 'postgres':
-                return $this->checkPostgresUserPrivileges($Storage);
+            case 'postgresql':
+                return $this->checkPostgreSQLUserPrivileges($Storage);
                 break;
 
             case 'sqlite':
-                return $this->checkSqliteUserPrivileges($Storage);
+                return $this->checkSQLiteUserPrivileges($Storage);
                 break;
                 
             default:
-                return $this->addError('Unknown storage API.');
+                return $this->addError('Unknown storage API: '.$sName);
         }
         
         return true;
@@ -365,7 +370,7 @@
 
     // --------------------------------------------------------------------
 
-    private function checkMySqlUserPrivileges($Storage) {
+    private function checkMySQLUserPrivileges($Storage) {
 
         // Determine required connector user privileges. MySQL
         // unfortunately returns only a string that we have to scan for
@@ -417,15 +422,15 @@
 
     // --------------------------------------------------------------------
 
-    private function checkPostgresUserPrivileges($Storage) {
+    private function checkPostgreSQLUserPrivileges($Storage) {
         return $this->addError(
-            'User privilege check not implemented for Postgres. Halt.'
+            'User privilege check not implemented for PostgreSQL. Halt.'
         );
     }
 
     // --------------------------------------------------------------------
 
-    private function checkSqliteUserPrivileges($Storage) {
+    private function checkSQLiteUserPrivileges($Storage) {
         return $this->addError(
             'User privilege check not implemented for SQLite. Halt.'
         );