CVS update: /cowiki/htdocs/setup/class/task/
[email protected] 27 Apr 2005 04:36:47 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/04/26 21:36:47 Modified: cowiki/htdocs/setup/class/task/class.TaskDocumentStorageConnector.php Log: Try to check the cases where a user selected to use an existing database, but this database does not yet exist 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.1&r2=1.2 Delta lines: +40 -2 -------------------- --- class.TaskDocumentStorageConnector.php 21 Apr 2005 00:17:14 -0000 1.1 +++ class.TaskDocumentStorageConnector.php 27 Apr 2005 04:36:44 -0000 1.2 @@ -2,7 +2,7 @@ /** * - * $Id: class.TaskDocumentStorageConnector.php,v 1.1 2005/04/21 00:17:14 dgorski Exp $ + * $Id: class.TaskDocumentStorageConnector.php,v 1.2 2005/04/27 04:36:44 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.1 $ + * @version $Revision: 1.2 $ * */ @@ -336,6 +336,25 @@ // Try to connect to database with given root or connector user // credentials if (!($rLink = @mysql_connect($sHost, $sUser, $sPass))) { + + // Try to check the cases where a user selected to use an + // existing database, but this database does not yet exist. + switch (mysql_errno()) { + case 1045: + $this->addError( + 'Are you sure that this database exists? If it does, + the given connector user is not set up correctly.' + ); + break; + + default: + $this->addError( + 'Got error #'.mysql_errno().' from database. + We don\'t know what it is. Please report it.' + ); + break; + } + return $this->addError('MySQL connection error: '.mysql_error()); } @@ -485,6 +504,25 @@ // Try to connect to database with given root or connector user // credentials if (!($rLink = @mysqli_connect($sHost, $sUser, $sPass))) { + + // Try to check the cases where a user selected to use an + // existing database, but this database does not yet exist. + switch (mysqli_connect_errno()) { + case 1045: + $this->addError( + 'Are you sure that this database exists? If it does, + the given connector user is not set up correctly.' + ); + break; + + default: + $this->addError( + 'Got error #'.mysqli_connect_errno().' from database. + We don\'t know what it is. Please report it.' + ); + break; + } + return $this->addError( 'MySQLi connection error: '.mysqli_connect_error() );