CVS update: /cowiki/htdocs/setup/class/task/
[email protected] 2 May 2005 22:04:31 -0000
| Newsgroups | gmane.comp.php.cowiki.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: dgorski Date: 2005/05/02 15:04:31 Modified: cowiki/htdocs/setup/class/task/class.AbstractTask.php Log: Added helper methods "assembleDSN()", "getDocumentStorageDSN()" and "getDocumentStorageRootDSN()" File Changes: Directory: /cowiki/htdocs/setup/class/task/ =========================================== File [changed]: class.AbstractTask.php Url: http://cowiki.tigris.org/source/browse/cowiki/htdocs/setup/class/task/class.AbstractTask.php?r1=1.2&r2=1.3 Delta lines: +42 -2 -------------------- --- class.AbstractTask.php 27 Apr 2005 01:41:21 -0000 1.2 +++ class.AbstractTask.php 2 May 2005 22:04:29 -0000 1.3 @@ -2,7 +2,7 @@ /** * - * $Id: class.AbstractTask.php,v 1.2 2005/04/27 01:41:21 dgorski Exp $ + * $Id: class.AbstractTask.php,v 1.3 2005/05/02 22:04:29 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.2 $ + * @version $Revision: 1.3 $ * */ @@ -273,6 +273,46 @@ } return new Config($this->State->getIncludesPath() . $sConf); + } + + // -------------------------------------------------------------------- + + // Assemble DSN path + private function assembleDSN($sScheme, $sUser, $sPass, $sHost, + $sPort, $sDatabase) { + + $sStr = $sScheme . '://' . $sUser . ':' . $sPass; + $sStr .= '@' . $sHost; + if (trim($sPort) != '') { $sStr .= ':' . $sPort; } + $sStr .= '/' . $sDatabase; + + return $sStr; + } + + // -------------------------------------------------------------------- + + protected function getDocumentStorageDSN() { + return $this->assembleDSN( + $this->State->getDocStorageScheme(), + $this->State->getDocStorageConnectorUser(), + $this->State->getDocStorageConnectorPassword(), + $this->State->getDocHost(), + $this->State->getDocHostPort(), + $this->State->getDocDatabaseName() + ); + } + + // -------------------------------------------------------------------- + + protected function getDocumentStorageRootDSN() { + return $this->assembleDSN( + $this->State->getDocStorageScheme(), + $this->State->getDocStorageAdminUser(), + $this->State->getDocStorageAdminPassword(), + $this->State->getDocHost(), + $this->State->getDocHostPort(), + $this->State->getDocDatabaseName() + ); } // --------------------------------------------------------------------