Permalink
Browse files

Refs #1114 - Only load PEAR_Config / PEAR_PackageFile when PearPackag…

…eScanner is instantiated
  • Loading branch information...
1 parent 4aae636 commit 0469c41477d87124a25da0cc4e2e8170c04343f8 @mrook mrook committed Jul 1, 2014
Showing with 13 additions and 2 deletions.
  1. +13 −2 classes/phing/util/PearPackageScanner.php
@@ -12,8 +12,6 @@
* @link http://www.phing.info/
*/
require_once 'phing/util/DirectoryScanner.php';
-require_once 'PEAR/Config.php';
-require_once 'PEAR/PackageFile.php';
/**
* Scans for files in a PEAR package.
@@ -34,6 +32,19 @@ class PearPackageScanner extends DirectoryScanner
protected $packageFile;
/**
+ * Load PEAR_Config and PEAR_PackageFile
+ */
+ public function __construct()
+ {
+ @require_once 'PEAR/Config.php';
+ @require_once 'PEAR/PackageFile.php';
+
+ if (! class_exists('PEAR_Config')) {
+ throw new BuildException(__CLASS__ . " requires PEAR to be installed");
+ }
+ }
+
+ /**
* Sets the package.xml file to read, instead of using the
* local pear installation.
*

0 comments on commit 0469c41

Please sign in to comment.