cvs: pear /Services_Weather/Weather Common.php

From: Date: Sun, 05 Oct 2003 20:57:07 +0000
Subject: cvs: pear /Services_Weather/Weather Common.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-13405@lists.php.net to get a copy of this message
eru Sun Oct 5 16:57:07 2003 EDT Modified files: /pear/Services_Weather/Weather Common.php Log: *Removed need for PEAR_Registry Index: pear/Services_Weather/Weather/Common.php diff -u pear/Services_Weather/Weather/Common.php:1.10 pear/Services_Weather/Weather/Common.php:1.11 --- pear/Services_Weather/Weather/Common.php:1.10 Sun Oct 5 13:46:19 2003 +++ pear/Services_Weather/Weather/Common.php Sun Oct 5 16:57:07 2003 @@ -16,12 +16,10 @@ // | Authors: Alexander Wirtz <alex@pc4p.net> | // +----------------------------------------------------------------------+ // -// $Id: Common.php,v 1.10 2003/10/05 17:46:19 eru Exp $ +// $Id: Common.php,v 1.11 2003/10/05 20:57:07 eru Exp $ require_once "Services/Weather.php"; -require_once "PEAR/Registry.php"; - // {{{ constants // {{{ natural constants and measures define("SERVICES_WEATHER_RADIUS_EARTH", 6378.15); @@ -133,7 +131,17 @@ */ function Services_Weather_Common() { - $this->_registry = new PEAR_Registry(); + $files = array("Cache.php"); + $incPath = get_include_path(); + $incPath = strpos($incPath, ";") ? explode(";", $incPath) : explode(":", $incPath); + for ($i = 0; $i < sizeof($files); $i++) { + for ($j = 0; $j < sizeof($incPath); $j++) { + if (file_exists($incPath[$j]."/".$files[$i])) { + $this->{"_has".basename($files[$i], ".php")} = true; + break; + } + } + } } // }}} @@ -149,7 +157,7 @@ */ function setCache($cacheType = "file", $cacheOptions = array()) { - if($this->_registry->packageExists("Cache")) { + if($this->_hasCache) { require_once "Cache.php"; @$cache = new Cache($cacheType, $cacheOptions); // The error handling in Cache is a bit crummy (read: not existent) @@ -163,6 +171,8 @@ $this->_cacheEnabled = true; return true; } + } else { + return Services_Weather::raiseError(SERVICES_WEATHER_ERROR_CACHE_INIT_FAILED); } } // }}}

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