cvs: php4 /pear PEAR.php

From: Date: Mon, 17 Jun 2002 13:39:29 +0000
Subject: cvs: php4 /pear PEAR.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4661@lists.php.net to get a copy of this message
cox Mon Jun 17 09:39:29 2002 EDT Modified files: /php4/pear PEAR.php Log: Added PEAR::loadExtension($ext) - OS independant PHP extension load # PEAR developers, please use this function if you need to check or # load an extension. Index: php4/pear/PEAR.php diff -u php4/pear/PEAR.php:1.42 php4/pear/PEAR.php:1.43 --- php4/pear/PEAR.php:1.42 Mon Jun 17 09:32:42 2002 +++ php4/pear/PEAR.php Mon Jun 17 09:39:29 2002 @@ -18,7 +18,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> | // +----------------------------------------------------------------------+ // -// $Id: PEAR.php,v 1.42 2002/06/17 13:32:42 cox Exp $ +// $Id: PEAR.php,v 1.43 2002/06/17 13:39:29 cox Exp $ // define('PEAR_ERROR_RETURN', 1); @@ -562,6 +562,35 @@ $this->setErrorHandling($mode, $options); } else { PEAR::setErrorHandling($mode, $options); + } + return true; + } + + // }}} + // {{{ assertExtension() + + /** + * OS independant PHP extension load + * + * @param string $ext The extension name + * @return bool Success or not on the dl() call + */ + function loadExtension($ext) + { + if (!extension_loaded($ext)) { + if (OS_WINDOWS) { + $suffix = '.dll'; + } elseif (PHP_OS == 'HP-UX') { + $suffix = '.sl'; + } elseif (PHP_OS == 'AIX') { + $suffix = '.a'; + } elseif (PHP_OS == 'OSX') { + $suffix = '.bundle'; + } else { + $suffix = '.so'; + } + $ext = strtolower($ext); + return @dl('php_'.$ext.$suffix) || @dl($ext.$suffix); } return true; }

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