/** * Creates an instance of the given update class. * * @access public * @param string $driver The type of PPU to create. * @param string $packageName The package to update. * @param string $channel The channel the package resides on. * @return object An instance of type PEAR_PackageUpdate_$driver * @since 0.4.0a1 * @throws PEAR_PACKAGEUPDATE_ERROR_NONEXISTENTDRIVER */ function &factory($driver, $packageName, $channel) { $class = 'PEAR_PackageUpdate_' . $driver; // Attempt to include a custom version of the named class, but don't treat // a failure as fatal. The caller may have already included their own // version of the named class. if (!class_exists($class)) { // Try to include the driver. $file = 'PEAR/PackageUpdate/' . $driver . '.php'; if (!PEAR_PackageUpdate::isIncludable($file)) { PEAR_ErrorStack::staticPush('PEAR_PackageUpdate', PEAR_PACKAGEUPDATE_ERROR_NONEXISTENTDRIVER, null, array('drivername' => $driver), $GLOBALS['_PEAR_PACKAGEUPDATE_ERRORS'][PEAR_PACKAGEUPDATE_ERROR_NONEXISTENTDRIVER]); // Must assign a variable to avoid notice about references. $false = false; return $false; } include_once $file; } // See if the class exists now. if (!class_exists($class)) { // Must assign a variable to avoid notice about references. $false = false; return $false; } // Try to instantiate the class. $instance =& new $class($packageName, $channel); return $instance; }