/** * Import options from an existing package.xml * * @param string $packagefile name of package file * @param array $options (optional) list of generation options * * @return PEAR_PackageFileManager2|PEAR_Error * @static * @access public * @since 1.6.0a1 */ function &importOptions($packagefile, $options = array()) { if (is_a($packagefile, 'PEAR_PackageFile_v1')) { $gen =& $packagefile->getDefaultGenerator(); $res = $gen->toV2('PEAR_PackageFileManager2'); if (PEAR::isError($res)) { return $res; } $res->setOld(); if (isset($options['cleardependencies']) && $options['cleardependencies']) { $res->clearDeps(); } if (!isset($options['clearcontents']) || $options['clearcontents']) { $res->clearContents(); } else { $res->_importTasks($options); } $packagefile = $packagefile->getPackageFile(); } if (!isset($res)) { if (PEAR::isError($res =& PEAR_PackageFileManager2::_getExistingPackageXML(dirname($packagefile) . DIRECTORY_SEPARATOR, basename($packagefile), $options))) { return $res; } } if (PEAR::isError($ret = $res->_importOptions($packagefile, $options))) { return $ret; } return $res; }