CVS update: /cowiki/includes/cowiki/class/dao/
[email protected] 2 May 2005 04:00:51 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/05/01 21:00:51 Modified: cowiki/includes/cowiki/class/dao/class.StorageFactory.php Log: Catch database selection exception first and swallow it. This will allow to return valid $Storage back to caller, even if the database could not selected. This behaviour is e.g. necessary for a client that a) can connect but b) can not _use_ (maybe not yet existing) database. Factory design weirdness :-/ File Changes: Directory: /cowiki/includes/cowiki/class/dao/ ============================================= File [changed]: class.StorageFactory.php Url: http://cowiki.tigris.org/source/browse/cowiki/includes/cowiki/class/dao/class.StorageFactory.php?r1=1.17&r2=1.18 Delta lines: +22 -10 --------------------- --- class.StorageFactory.php 2 May 2005 03:33:21 -0000 1.17 +++ class.StorageFactory.php 2 May 2005 04:00:49 -0000 1.18 @@ -2,7 +2,7 @@ /** * - * $Id: class.StorageFactory.php,v 1.17 2005/05/02 03:33:21 dgorski Exp $ + * $Id: class.StorageFactory.php,v 1.18 2005/05/02 04:00:49 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.17 $ + * @version $Revision: 1.18 $ * */ @@ -166,7 +166,16 @@ $UriInfo->get('pass') ); + // Catch database selection exception first and swallow it. + // This will allow to return valid $Storage back to caller, + // even if the database could not selected. This behaviour + // is e.g. necessary for a client that a) can connect + // but b) can not _use_ (maybe not yet existing) database. + try { $Storage->useDatabase($UriInfo->get('basepath')); + } catch (StorageDatabaseSelectionException $sdse) { + // swallow + } // Remember for future calls (resource recycling) $this->aCache[$sResource] = $Storage; @@ -176,9 +185,6 @@ } catch (StorageConnectionFailureException $scfe) { throw $scfe; // rethrow, remember that this is catchable - } catch (StorageDatabaseSelectionException $sdse) { - throw $sdse; // rethrow, remember that this is catchable - } catch (StorageException $se) { throw $se; // rethrow, remember that this is catchable } @@ -200,7 +206,16 @@ $UriInfo->get('pass') ); + // Catch database selection exception first and swallow it. + // This will allow to return valid $Storage back to caller, + // even if the database could not selected. This behaviour + // is e.g. necessary for a client that a) can connect + // but b) can not _use_ (maybe not yet existing) database. + try { $Storage->useDatabase($UriInfo->get('basepath')); + } catch (StorageDatabaseSelectionException $sdse) { + // swallow + } // Remember for future calls (resource recycling) $this->aCache[$sResource] = $Storage; @@ -209,9 +224,6 @@ } catch (StorageConnectionFailureException $scfe) { throw $scfe; // rethrow, remember that this is catchable - - } catch (StorageDatabaseSelectionException $sdse) { - throw $sdse; // rethrow, remember that this is catchable } catch (StorageException $se) { throw $se; // rethrow, remember that this is catchable