svn: /phd/trunk/phpdotnet/phd/ Config.php Options/Handler.php
| From: | Moacir de Oliveira Miranda Júnior | Date: | Sun, 29 May 2011 15:56:43 +0000 |
| Subject: | svn: /phd/trunk/phpdotnet/phd/ Config.php Options/Handler.php | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-8188@lists.php.net to get a copy of this message | ||
moacir Sun, 29 May 2011 15:56:43 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=311551
Log:
Do not automatically add package dirs, use the option --packagedir instead
* New option --packagedir (-k) <path> to run an external package
Changed paths:
U phd/trunk/phpdotnet/phd/Config.php
U phd/trunk/phpdotnet/phd/Options/Handler.php
Modified: phd/trunk/phpdotnet/phd/Config.php
===================================================================
--- phd/trunk/phpdotnet/phd/Config.php 2011-05-29 14:45:45 UTC (rev 311550)
+++ phd/trunk/phpdotnet/phd/Config.php 2011-05-29 15:56:43 UTC (rev 311551)
@@ -73,14 +73,6 @@
self::$optionArray = self::$optionArrayDefault;
}
- // add the include-path to the package dirs
- $include_path = explode(PATH_SEPARATOR, get_include_path());
- foreach ($include_path as $dir) {
- if ($dir != __INSTALLDIR__) {
- self::$optionArray['package_dirs'][] = $dir;
- }
- }
-
// now merge other options
self::$optionArray = array_merge(self::$optionArray, (array)$a);
@@ -149,14 +141,12 @@
}
public static function getSupportedPackages() {
- static $packageList = array();
- if (!$packageList) {
- foreach(Config::package_dirs() as $dir) {
- foreach (glob($dir . "/phpdotnet/phd/Package/*", GLOB_ONLYDIR) as $item)
{
- $baseitem = basename($item);
- if ($baseitem[0] != '.') {
- $packageList[] = $baseitem;
- }
+ $packageList = array();
+ foreach(Config::package_dirs() as $dir) {
+ foreach (glob($dir . "/phpdotnet/phd/Package/*", GLOB_ONLYDIR) as $item) {
+ $baseitem = basename($item);
+ if ($baseitem[0] != '.') {
+ $packageList[] = $baseitem;
}
}
}
Modified: phd/trunk/phpdotnet/phd/Options/Handler.php
===================================================================
--- phd/trunk/phpdotnet/phd/Options/Handler.php 2011-05-29 14:45:45 UTC (rev 311550)
+++ phd/trunk/phpdotnet/phd/Options/Handler.php 2011-05-29 15:56:43 UTC (rev 311551)
@@ -29,6 +29,7 @@
'saveconfig::' => 'S::', // Save the generated config ?
'quit' => 'Q', // Do not run the render. Use
with -S to just save the config.
'memoryindex' => 'M', // Use sqlite in memory rather
then file
+ 'packagedir' => 'k:', // Include path for external
packages
);
}
@@ -315,6 +316,26 @@
Config::set_css($styles);
}
+ public function option_k($k, $v)
+ {
+ $this->option_packagedir($k, $v);
+ }
+
+ public function option_packagedir($k, $v)
+ {
+ $packages = Config::package_dirs();
+ foreach((array)$v as $key => $val) {
+ if ($path = realpath($val)) {
+ if (!in_array($path, $packages)) {
+ $packages[] = $path;
+ }
+ } else {
+ v('Invalid path: %s', $val, E_USER_WARNING);
+ }
+ }
+ Config::set_package_dirs($packages);
+ }
+
public function option_x($k, $v)
{
$this->option_xinclude($k, 'true');
@@ -404,7 +425,10 @@
-Q
--quit Don't run the build. Use with --saveconfig to
just save the config.
+ -k
+ --packagedir Use an external package directory.
+
Most options can be passed multiple times for greater effect.
";
exit(0);