cvs: pear /LiveUser/Perm/Storage SQL.php

From: Date: Tue, 07 Jun 2005 14:40:23 +0000
Subject: cvs: pear /LiveUser/Perm/Storage SQL.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-32408@lists.php.net to get a copy of this message
lsmith Tue Jun 7 10:40:23 2005 EDT Modified files: /pear/LiveUser/Perm/Storage SQL.php Log: - moved generic code to Storage.php - added universal disconnect() implementation http://cvs.php.net/diff.php/pear/LiveUser/Perm/Storage/SQL.php?r1=1.18&r2=1.19&ty=u Index: pear/LiveUser/Perm/Storage/SQL.php diff -u pear/LiveUser/Perm/Storage/SQL.php:1.18 pear/LiveUser/Perm/Storage/SQL.php:1.19 --- pear/LiveUser/Perm/Storage/SQL.php:1.18 Wed Apr 6 13:16:39 2005 +++ pear/LiveUser/Perm/Storage/SQL.php Tue Jun 7 10:40:23 2005 @@ -40,7 +40,7 @@ * @author Bjoern Kraus <krausbn@php.net> * @copyright 2002-2005 Markus Wolff * @license http://www.gnu.org/licenses/lgpl.txt - * @version CVS: $Id: SQL.php,v 1.18 2005/04/06 17:16:39 lsmith Exp $ + * @version CVS: $Id: SQL.php,v 1.19 2005/06/07 14:40:23 lsmith Exp $ * @link http://pear.php.net/LiveUser */ @@ -48,7 +48,6 @@ * Require parent class definition. */ require_once 'LiveUser/Perm/Storage.php'; -require_once 'LiveUser/Perm/Storage/Globals.php'; /** * SQL container for permission handling @@ -89,54 +88,26 @@ var $prefix = 'liveuser_'; /** + * Properly disconnect from database * - * @access public - * @var array - */ - var $tables = array(); - - /** - * - * @access public - * @var array - */ - var $fields = array(); - - /** - * - * @access public - * @var array - */ - var $alias = array(); - - /** - * - * - * - * @param array &$storageConf Array with the storage configuration - * @return boolean true on success, false on failure. + * @return void * * @access public */ - function init(&$storageConf) + function disconnect() { - parent::init($storageConf); - - if (empty($this->tables)) { - $this->tables = $GLOBALS['_LiveUser']['perm']['tables']; - } else { - $this->tables = LiveUser::arrayMergeClobber($GLOBALS['_LiveUser']['perm']['tables'], $this->tables); - } - if (empty($this->fields)) { - $this->fields = $GLOBALS['_LiveUser']['perm']['fields']; - } else { - $this->fields = LiveUser::arrayMergeClobber($GLOBALS['_LiveUser']['perm']['fields'], $this->fields); - } - if (empty($this->alias)) { - $this->alias = $GLOBALS['_LiveUser']['perm']['alias']; - } else { - $this->alias = LiveUser::arrayMergeClobber($GLOBALS['_LiveUser']['perm']['alias'], $this->alias); + if ($this->dsn) { + $result = $this->dbc->disconnect(); + if (PEAR::isError($result)) { + $this->_stack->push( + LIVEUSER_ERROR, 'exception', + array('reason' => $result->getMessage() . '-' . $result->getUserInfo()) + ); + return false; + } + $this->dbc = null; } + return true; } } ?> \ No newline at end of file

« previous php.pear.cvs (#32408) next »