pajoye Thu Jun 8 00:02:38 2006 UTC
Modified files:
/pear-core/PEAR PackageFile.php
Log:
- #7830, allow to path a directory to fromAnyFile, presene of package.xml
or package2.xml is checked and used
http://cvs.php.net/viewcvs.cgi/pear-core/PEAR/PackageFile.php?r1=1.35&r2=1.36&diff_format=u
Index: pear-core/PEAR/PackageFile.php
diff -u pear-core/PEAR/PackageFile.php:1.35 pear-core/PEAR/PackageFile.php:1.36
--- pear-core/PEAR/PackageFile.php:1.35 Mon Mar 27 04:23:47 2006
+++ pear-core/PEAR/PackageFile.php Thu Jun 8 00:02:38 2006
@@ -15,7 +15,7 @@
* @author Greg Beaver <cellog@xxxxxxx>
* @copyright 1997-2006 The PHP Group
* @license http://www.php.net/license/3_0.txt PHP License 3.0
- * @version CVS: $Id: PackageFile.php,v 1.35 2006/03/27 04:23:47 cellog Exp
$
+ * @version CVS: $Id: PackageFile.php,v 1.36 2006/06/08 00:02:38 pajoye Exp
$
* @link http://pear.php.net/package/PEAR
* @since File available since Release 1.4.0a1
*/
@@ -397,6 +397,18 @@
*/
function &fromAnyFile($info, $state)
{
+ if (is_dir($info)) {
+ $dir_name = realpath($info);
+ if (file_exists($dir_name . '/package.xml')) {
+ $info = PEAR_PackageFile::fromPackageFile($dir_name .
'/package.xml', $state);
+ } elseif (file_exists($dir_name . '/package2.xml')) {
+ $info = PEAR_PackageFile::fromPackageFile($dir_name .
'/package2.xml', $state);
+ } else {
+ $info = PEAR::raiseError("No package definition found in
'$info' directory");
+ }
+ return $info;
+ }
+
$fp = false;
if (is_string($info) && strlen($info) < 255 &&
(file_exists($info) || ($fp = @fopen($info, 'r')))) {
@@ -426,4 +438,4 @@
}
}
-?>
\ No newline at end of file
+?>
--
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|