cvs: pear /LiveUser_Admin Admin.php

From: Date: Fri, 30 Sep 2005 11:10:29 +0000
Subject: cvs: pear /LiveUser_Admin Admin.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-35171@lists.php.net to get a copy of this message
lsmith Fri Sep 30 07:10:29 2005 EDT Modified files: /pear/LiveUser_Admin Admin.php Log: - removed autoInit (call setAdminContainers() manually instead) - reworked log/debug handling (there is a new 'debug' conf option which can either be a bool or a log instance) - made the log property public which made it possible to remove addErrorLog() - use static LiveUser::PEARLogFactory instead of loadPEARLog() http://cvs.php.net/diff.php/pear/LiveUser_Admin/Admin.php?r1=1.46&r2=1.47&ty=u Index: pear/LiveUser_Admin/Admin.php diff -u pear/LiveUser_Admin/Admin.php:1.46 pear/LiveUser_Admin/Admin.php:1.47 --- pear/LiveUser_Admin/Admin.php:1.46 Wed Sep 14 08:52:41 2005 +++ pear/LiveUser_Admin/Admin.php Fri Sep 30 07:10:29 2005 @@ -57,7 +57,7 @@ * @author Bjoern Kraus <krausbn@php.net> * @copyright 2002-2005 Markus Wolff * @license http://www.gnu.org/licenses/lgpl.txt - * @version CVS: $Id: Admin.php,v 1.46 2005/09/14 12:52:41 lsmith Exp $ + * @version CVS: $Id: Admin.php,v 1.47 2005/09/30 11:10:29 lsmith Exp $ * @link http://pear.php.net/LiveUser_Admin */ @@ -173,65 +173,19 @@ */ var $_log = null; - function LiveUser_Admin() + function LiveUser_Admin($debug) { $this->_stack = &PEAR_ErrorStack::singleton('LiveUser_Admin'); - if ($GLOBALS['_LIVEUSER_DEBUG']) { - if (!is_object($this->_log)) { - $this->loadPEARLog(); - } - $winlog = &Log::factory('win', 'LiveUser_Admin'); - $this->_log->addChild($winlog); + if ($debug) { + $this->log =& LiveUser::PEARLogFactory($debug); + $this->_stack->setLogger($this->log); } $this->_stack->setErrorMessageTemplate($this->_errorMessages); } /** - * This method lazy loads PEAR::Log - * - * @return void - * - * @access protected - */ - function loadPEARLog() - { - require_once 'Log.php'; - $this->_log = &Log::factory('composite'); - $this->_stack->setLogger($this->_log); - } - - /** - * Add error logger for use by Errorstack. - * - * Be aware that if you need add a log - * at the beginning of your code if you - * want it to be effective. A log will only - * be taken into account after it's added. - * - * Sample usage: - * <code> - * $lu_object = &LiveUser_Admin::singleton($conf); - * $logger = &Log::factory('mail', 'bug@example.com', - * 'myapp_debug_mail_log', array('from' => 'application_bug@example.com')); - * $lu_object->addErrorLog($logger); - * </code> - * - * @param Log &$log logger instance - * @return boolean true on success or false on failure - * - * @access public - */ - function addErrorLog(&$log) - { - if (!is_object($this->_log)) { - $this->loadPEARLog(); - } - return $this->_log->addChild($log); - } - - /** * * @param array $conf configuration array * @return object @@ -239,15 +193,17 @@ * @access public * @see setAdminContainers */ - function &factory($conf) + function &factory(&$conf) { - $obj = &new LiveUser_Admin; + $debug = false; + if (array_key_exists('debug', $conf)) { + $debug =& $conf['debug']; + } - if (is_array($conf) && !empty($conf)) { - $obj->_conf = $conf; - if (array_key_exists('autoInit', $obj->_conf) && $obj->_conf['autoInit']) { - $obj->setAdminContainers(); - } + $obj = &new LiveUser_Admin($debug); + + if (is_array($conf)) { + $obj->_conf =& $conf; } return $obj; @@ -261,7 +217,7 @@ * @access public * @see factory */ - function &singleton($conf = null) + function &singleton(&$conf) { static $instance; @@ -277,27 +233,6 @@ } /** - * Merges the current configuration array with configuration array pases - * along with the method call. - * - * @param array $conf configuration array - * @return boolean true upon success, false otherwise - * - * @access public - */ - function setConfArray($conf) - { - if (!is_array($conf)) { - $this->_stack->push(LIVEUSER_ADMIN_ERROR, 'exception', - array('msg' => 'Missing configuration array')); - return false; - } - - $this->_conf = LiveUser::arrayMergeClobber($this->_conf, $conf); - return true; - } - - /** * Sets the current auth container to the one with the given auth container name * * Upon success it will return true. You can then

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