Skip to content
Snippets Groups Projects
Commit 52d3729c authored by Brett T Bieber's avatar Brett T Bieber
Browse files

Remove the PEAR package as it isn't needed. Replace the lib directory with a...

Remove the PEAR package as it isn't needed. Replace the lib directory with a pyrus (PEAR2) controlled registry of the required packages. UNL_DWT, UNL_Templates, and UNL_Cache_Lite. Update include path where necessary to point to this lib directory.

git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@151 20a16fea-79d4-4915-8869-1ea9d5ebf173
parent ef64c16b
No related branches found
No related tags found
No related merge requests found
Showing
with 1229 additions and 1755 deletions
<?xml version="1.0"?>
<pearconfig version="1.0"><php_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/php</php_dir><ext_dir>/usr/local/lib/php/extensions/no-debug-non-zts-20090626/</ext_dir><cfg_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/cfg</cfg_dir><doc_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/docs</doc_dir><bin_dir>/usr/local/bin</bin_dir><data_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/data</data_dir><www_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/www</www_dir><test_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/tests</test_dir><src_dir>/Users/bbieber/Documents/workspace/wdn_thm_drupal/sites/all/themes/unl_wdn/lib/src</src_dir><php_bin>/usr/local/bin/php</php_bin><php_ini>/usr/local/lib/php.ini</php_ini><php_prefix></php_prefix><php_suffix></php_suffix></pearconfig>
File added
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>__uri</name>
<suggestedalias>__uri</suggestedalias>
<summary>Pseudo-channel for static packages</summary>
<servers>
<primary>
<xmlrpc>
<function version="1.0">****</function>
</xmlrpc>
</primary>
</servers>
</channel>
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>doc.php.net</name>
<suggestedalias>phpdocs</suggestedalias>
<summary>PHP Documentation team</summary>
<servers>
<primary>
<rest>
<baseurl type="REST1.0">http://doc.php.net/rest/</baseurl>
<baseurl type="REST1.1">http://doc.php.net/rest/</baseurl>
</rest>
</primary>
</servers>
</channel>
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>pear.php.net</name>
<suggestedalias>pear</suggestedalias>
<summary>PHP Extension and Application Repository</summary>
<servers>
<primary>
<rest>
<baseurl type="REST1.0">http://pear.php.net/rest/</baseurl>
<baseurl type="REST1.1">http://pear.php.net/rest/</baseurl>
<baseurl type="REST1.2">http://pear.php.net/rest/</baseurl>
<baseurl type="REST1.3">http://pear.php.net/rest/</baseurl>
</rest>
</primary>
<mirror host="us.pear.php.net">
<rest>
<baseurl type="REST1.0">http://us.pear.php.net/rest/</baseurl>
<baseurl type="REST1.1">http://us.pear.php.net/rest/</baseurl>
<baseurl type="REST1.2">http://us.pear.php.net/rest/</baseurl>
<baseurl type="REST1.3">http://us.pear.php.net/rest/</baseurl>
</rest>
</mirror>
<mirror host="de.pear.php.net" ssl="yes" port="3452">
<rest>
<baseurl type="REST1.0">https://de.pear.php.net:3452/rest/</baseurl>
<baseurl type="REST1.1">https://de.pear.php.net:3452/rest/</baseurl>
<baseurl type="REST1.2">https://de.pear.php.net:3452/rest/</baseurl>
<baseurl type="REST1.3">https://de.pear.php.net:3452/rest/</baseurl>
</rest>
</mirror>
</servers>
</channel>
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>pear.unl.edu</name>
<summary>UNL PHP Extension and Application Repository</summary>
<suggestedalias>unl</suggestedalias>
<servers>
<primary>
<rest>
<baseurl type="REST1.0">http://pear.unl.edu/Chiara_PEAR_Server_REST/</baseurl>
<baseurl type="REST1.1">http://pear.unl.edu/Chiara_PEAR_Server_REST/</baseurl>
<baseurl type="REST1.3">http://pear.unl.edu/Chiara_PEAR_Server_REST/</baseurl>
</rest>
</primary>
</servers>
</channel>
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>pear2.php.net</name>
<suggestedalias>pear2</suggestedalias>
<summary>PEAR packages for PHP 5.3+ installed by Pyrus</summary>
<servers>
<primary>
<rest>
<baseurl type="REST1.0">http://pear2.php.net/rest/</baseurl>
<baseurl type="REST1.1">http://pear2.php.net/rest/</baseurl>
<baseurl type="REST1.2">http://pear2.php.net/rest/</baseurl>
<baseurl type="REST1.3">http://pear2.php.net/rest/</baseurl>
</rest>
</primary>
</servers>
</channel>
<?xml version="1.0" encoding="UTF-8"?>
<channel version="1.0" xmlns="http://pear.php.net/channel-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/channel-1.0http://pear.php.net/dtd/channel-1.0.xsd">
<name>pecl.php.net</name>
<suggestedalias>pecl</suggestedalias>
<summary>PHP Extension Community Library</summary>
<validatepackage version="1.0">PEAR_Validator_PECL</validatepackage>
<servers>
<primary>
<xmlrpc>
<function version="1.0">logintest</function>
<function version="1.0">package.listLatestReleases</function>
<function version="1.0">package.listAll</function>
<function version="1.0">package.info</function>
<function version="1.0">package.getDownloadURL</function>
<function version="1.0">package.getDepDownloadURL</function>
<function version="1.0">package.search</function>
<function version="1.0">channel.listAll</function>
</xmlrpc>
<rest>
<baseurl type="REST1.0">http://pecl.php.net/rest/</baseurl>
<baseurl type="REST1.1">http://pecl.php.net/rest/</baseurl>
</rest>
</primary>
</servers>
</channel>
__uri
\ No newline at end of file
pear.php.net
\ No newline at end of file
pear2.php.net
\ No newline at end of file
pecl.php.net
\ No newline at end of file
doc.php.net
\ No newline at end of file
pear.unl.edu
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.0" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>UNL_Cache_Lite</name>
<channel>pear.unl.edu</channel>
<summary>Basic caching library</summary>
<description>This is a port of the Cache_Lite package from PEAR, with support for PHP 5 and
exceptions.
This package is a little cache system optimized for file containers. It is fast
and safe (because it uses file locking and/or anti-corruption tests).</description>
<lead>
<name>Brett Bieber</name>
<user>saltybeagle</user>
<email>brett.bieber@gmail.com</email>
<active>yes</active>
</lead>
<date>2010-09-08</date>
<time>10:31:46</time>
<version>
<release>0.1.0</release>
<api>0.1.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</license>
<notes>
Port of cache lite, remove PEAR dependency, use exceptions instead of PEAR_Error.
</notes>
<contents>
<dir name="/">
<file baseinstalldir="/" md5sum="ea88bd9816a106e30ac2939a28679fc7" name="UNL/Cache/Lite/Output.php" role="php"/>
<file baseinstalldir="/" md5sum="537413f3d9e949be31a1dd9f42c1dd5c" name="UNL/Cache/Lite/NestedOutput.php" role="php"/>
<file baseinstalldir="/" md5sum="95bccdc3a6ec0d54ab4adf3ce03d4b55" name="UNL/Cache/Lite/Function.php" role="php"/>
<file baseinstalldir="/" md5sum="33a3fc682d63cef8f5cf126637001662" name="UNL/Cache/Lite/File.php" role="php"/>
<file baseinstalldir="/" md5sum="7f02fa5030fe224535a8849aa0d98741" name="UNL/Cache/Lite.php" role="php"/>
<file baseinstalldir="/" md5sum="4c638b951a7c8a4dcb94f10abf1d818b" name="TODO" role="data"/>
<file baseinstalldir="/" md5sum="085e7fb76fb3fa8ba9e9ed0ce95a43f9" name="LICENSE" role="data"/>
<file baseinstalldir="/" md5sum="934071f21c17611811e01396ca604c79" name="docs/technical" role="doc"/>
<file baseinstalldir="/" md5sum="516beafae66ea4b9fd7d29ab9c90845d" name="docs/examples" role="doc"/>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.1.2</min>
</php>
<pearinstaller>
<min>1.5.4</min>
</pearinstaller>
</required>
</dependencies>
<phprelease>
<changelog>
<release>
<version>
<release>0.1.0</release>
<api>0.1.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2009-10-20</date>
<license uri="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</license>
<notes>
Port of cache lite, remove PEAR dependency, use exceptions instead of PEAR_Error.
</notes>
</release>
</changelog>
</phprelease>
</package>
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.8.2" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>UNL_DWT</name>
<channel>pear.unl.edu</channel>
<summary>This package generates php class files (objects) from Dreamweaver template files.</summary>
<description>This package generates php class files (objects) from Dreamweaver template files.</description>
<lead>
<name>Brett Bieber</name>
<user>saltybeagle</user>
<email>brett.bieber@gmail.com</email>
<active>yes</active>
</lead>
<date>2010-09-08</date>
<time>10:31:36</time>
<version>
<release>0.7.1</release>
<api>0.7.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD</license>
<notes>
Declare debug method correctly as static.
</notes>
<contents>
<dir name="/">
<file baseinstalldir="/" md5sum="d1fe9ae1c22c92cda6d57b9847fda7b2" name="UNL/DWT/Scanner.php" role="php"/>
<file baseinstalldir="/" md5sum="be81db10741075600fc87ebbc4c4ca53" name="UNL/DWT/Region.php" role="php"/>
<file baseinstalldir="/" md5sum="aea406280cedf3a0e9b32ab7ee354b3f" name="UNL/DWT/Generator.php" role="php"/>
<file baseinstalldir="/" md5sum="8ccd77b7def177033c20128da938d1ff" name="UNL/DWT/createTemplates.php" role="php"/>
<file baseinstalldir="/" md5sum="c8b1f16f587798a1e37574477d2627bd" name="UNL/DWT.php" role="php">
<tasks:replace from="@PHP_BIN@" to="php_bin" type="pear-config"/>
<tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
<tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
<tasks:replace from="@DOC_DIR@" to="doc_dir" type="pear-config"/>
</file>
<file baseinstalldir="/" md5sum="b524ef4684be7dba47ed8c245577347a" name="docs/examples/Template_style1.tpl" role="doc"/>
<file baseinstalldir="/" md5sum="3f97c4a024dfed9210b14db5068ba7d0" name="docs/examples/Template_style1.php" role="doc"/>
<file baseinstalldir="/" md5sum="0d5a4f5ca86e9c2a3c0050f39acbb034" name="docs/examples/template_style1.dwt" role="doc"/>
<file baseinstalldir="/" md5sum="fbc254138e8456e983e18c0c02cc7d30" name="docs/examples/scanner_example.php" role="doc"/>
<file baseinstalldir="/" md5sum="5d389d72ffe3a15a5dd597cd791a6963" name="docs/examples/example_style1.php" role="doc">
<tasks:replace from="@PHP_BIN@" to="php_bin" type="pear-config"/>
<tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
<tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
<tasks:replace from="@DOC_DIR@" to="doc_dir" type="pear-config"/>
</file>
<file baseinstalldir="/" md5sum="783c64aafb491c789fc71a5bf80d1755" name="docs/examples/example.ini" role="doc">
<tasks:replace from="@PHP_BIN@" to="php_bin" type="pear-config"/>
<tasks:replace from="@PHP_DIR@" to="php_dir" type="pear-config"/>
<tasks:replace from="@DATA_DIR@" to="data_dir" type="pear-config"/>
<tasks:replace from="@DOC_DIR@" to="doc_dir" type="pear-config"/>
</file>
</dir>
</contents>
<dependencies>
<required>
<php>
<min>5.0.0</min>
</php>
<pearinstaller>
<min>1.4.3</min>
</pearinstaller>
<package>
<name>UNL_Templates</name>
<channel>pear.unl.edu</channel>
<max>0.5.2</max>
<conflicts/>
</package>
</required>
</dependencies>
<phprelease>
<changelog>
<release>
<version>
<release>0.1.0</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<date>2006-01-26</date>
<license>PHP License</license>
<notes>
First release, only basic functionality.
</notes>
</release>
<release>
<version>
<release>0.1.1</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<date>2006-02-06</date>
<license>PHP License</license>
<notes>
Added generator options generator_include/eclude_regex and extends and extends_location.
Create dwt_location and tpl_location if it does not exist yet.
Remove editable region tags for locked regions.
</notes>
</release>
<release>
<version>
<release>0.1.2</release>
<api>0.1.0</api>
</version>
<stability>
<release>alpha</release>
<api>alpha</api>
</stability>
<date>2006-02-24</date>
<license>PHP License</license>
<notes>
* Added missing setOption function. Initially only debug option is available.
* Renamed internally used function between to UNL_DWT_between
* created externally callable replaceRegions function.
* debug function for outputting messages levels 0-5.
</notes>
</release>
<release>
<version>
<release>0.5.0</release>
<api>0.1.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2006-08-15</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Fix Bug #16: Locked regions arent detected correctly.
* Fix Bug #1: Include path modified incorrectly.
</notes>
</release>
<release>
<version>
<release>0.5.1</release>
<api>0.1.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2008-02-07</date>
<license uri="http://www.php.net/license">PHP License</license>
<notes>
* Switch to using static properties, PHP 5, add docheader.
</notes>
</release>
<release>
<version>
<release>0.6.0</release>
<api>0.2.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2008-03-26</date>
<license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD</license>
<notes>
Move code around. DWT.php is now in UNL/DWT.php instead of UNL/DWT/DWT.php = not compatible with old versions of UNL_Templates!
* Switch to using static properties
* Upgrade a lot of code to PHP 5
* Add phpdoc headers and coding standards fixes
* Switch to BSD license.
</notes>
</release>
<release>
<version>
<release>0.6.1</release>
<api>0.2.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2008-04-08</date>
<license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD</license>
<notes>
Change is_a() to instanceof to fix warning.
</notes>
</release>
<release>
<version>
<release>0.7.0</release>
<api>0.7.0</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2008-06-30</date>
<license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD</license>
<notes>
Move region class into separate file.
Add scanner for simply scanning a dwt for regions, this does not replace the
generator, but supplements it.
</notes>
</release>
<release>
<version>
<release>0.7.1</release>
<api>0.7.1</api>
</version>
<stability>
<release>beta</release>
<api>beta</api>
</stability>
<date>2009-07-01</date>
<license uri="http://www1.unl.edu/wdn/wiki/Software_License">BSD</license>
<notes>
Declare debug method correctly as static.
</notes>
</release>
</changelog>
</phprelease>
</package>
This diff is collapsed.
<?php
/**
* Class auto-loader
*
* PHP versions 4
*
* @category pear
* @package PEAR
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Autoloader.php 276383 2009-02-24 23:39:37Z dufuz $
* @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader
* @since File available since Release 0.1
* @deprecated File deprecated in Release 1.4.0a1
*/
// /* vim: set expandtab tabstop=4 shiftwidth=4: */
if (!extension_loaded("overload")) {
// die hard without ext/overload
die("Rebuild PHP with the `overload' extension to use PEAR_Autoloader");
}
/**
* Include for PEAR_Error and PEAR classes
*/
require_once "PEAR.php";
/**
* This class is for objects where you want to separate the code for
* some methods into separate classes. This is useful if you have a
* class with not-frequently-used methods that contain lots of code
* that you would like to avoid always parsing.
*
* The PEAR_Autoloader class provides autoloading and aggregation.
* The autoloading lets you set up in which classes the separated
* methods are found. Aggregation is the technique used to import new
* methods, an instance of each class providing separated methods is
* stored and called every time the aggregated method is called.
*
* @category pear
* @package PEAR
* @author Stig Bakken <ssb@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.9.1
* @link http://pear.php.net/manual/en/core.ppm.php#core.ppm.pear-autoloader
* @since File available since Release 0.1
* @deprecated File deprecated in Release 1.4.0a1
*/
class PEAR_Autoloader extends PEAR
{
// {{{ properties
/**
* Map of methods and classes where they are defined
*
* @var array
*
* @access private
*/
var $_autoload_map = array();
/**
* Map of methods and aggregate objects
*
* @var array
*
* @access private
*/
var $_method_map = array();
// }}}
// {{{ addAutoload()
/**
* Add one or more autoload entries.
*
* @param string $method which method to autoload
*
* @param string $classname (optional) which class to find the method in.
* If the $method parameter is an array, this
* parameter may be omitted (and will be ignored
* if not), and the $method parameter will be
* treated as an associative array with method
* names as keys and class names as values.
*
* @return void
*
* @access public
*/
function addAutoload($method, $classname = null)
{
if (is_array($method)) {
array_walk($method, create_function('$a,&$b', '$b = strtolower($b);'));
$this->_autoload_map = array_merge($this->_autoload_map, $method);
} else {
$this->_autoload_map[strtolower($method)] = $classname;
}
}
// }}}
// {{{ removeAutoload()
/**
* Remove an autoload entry.
*
* @param string $method which method to remove the autoload entry for
*
* @return bool TRUE if an entry was removed, FALSE if not
*
* @access public
*/
function removeAutoload($method)
{
$method = strtolower($method);
$ok = isset($this->_autoload_map[$method]);
unset($this->_autoload_map[$method]);
return $ok;
}
// }}}
// {{{ addAggregateObject()
/**
* Add an aggregate object to this object. If the specified class
* is not defined, loading it will be attempted following PEAR's
* file naming scheme. All the methods in the class will be
* aggregated, except private ones (name starting with an
* underscore) and constructors.
*
* @param string $classname what class to instantiate for the object.
*
* @return void
*
* @access public
*/
function addAggregateObject($classname)
{
$classname = strtolower($classname);
if (!class_exists($classname)) {
$include_file = preg_replace('/[^a-z0-9]/i', '_', $classname);
include_once $include_file;
}
$obj =& new $classname;
$methods = get_class_methods($classname);
foreach ($methods as $method) {
// don't import priviate methods and constructors
if ($method{0} != '_' && $method != $classname) {
$this->_method_map[$method] = $obj;
}
}
}
// }}}
// {{{ removeAggregateObject()
/**
* Remove an aggregate object.
*
* @param string $classname the class of the object to remove
*
* @return bool TRUE if an object was removed, FALSE if not
*
* @access public
*/
function removeAggregateObject($classname)
{
$ok = false;
$classname = strtolower($classname);
reset($this->_method_map);
while (list($method, $obj) = each($this->_method_map)) {
if (is_a($obj, $classname)) {
unset($this->_method_map[$method]);
$ok = true;
}
}
return $ok;
}
// }}}
// {{{ __call()
/**
* Overloaded object call handler, called each time an
* undefined/aggregated method is invoked. This method repeats
* the call in the right aggregate object and passes on the return
* value.
*
* @param string $method which method that was called
*
* @param string $args An array of the parameters passed in the
* original call
*
* @return mixed The return value from the aggregated method, or a PEAR
* error if the called method was unknown.
*/
function __call($method, $args, &$retval)
{
$method = strtolower($method);
if (empty($this->_method_map[$method]) && isset($this->_autoload_map[$method])) {
$this->addAggregateObject($this->_autoload_map[$method]);
}
if (isset($this->_method_map[$method])) {
$retval = call_user_func_array(array($this->_method_map[$method], $method), $args);
return true;
}
return false;
}
// }}}
}
overload("PEAR_Autoloader");
?>
<?php
/**
* PEAR_Builder for building PHP extensions (PECL packages)
*
* PHP versions 4 and 5
*
* @category pear
* @package PEAR
* @author Stig Bakken <ssb@php.net>
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Builder.php 276383 2009-02-24 23:39:37Z dufuz $
* @link http://pear.php.net/package/PEAR
* @since File available since Release 0.1
*
* TODO: log output parameters in PECL command line
* TODO: msdev path in configuration
*/
/**
* Needed for extending PEAR_Builder
*/
require_once 'PEAR/Common.php';
require_once 'PEAR/PackageFile.php';
/**
* Class to handle building (compiling) extensions.
*
* @category pear
* @package PEAR
* @author Stig Bakken <ssb@php.net>
* @author Greg Beaver <cellog@php.net>
* @copyright 1997-2009 The Authors
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version Release: 1.9.1
* @link http://pear.php.net/package/PEAR
* @since Class available since PHP 4.0.2
* @see http://pear.php.net/manual/en/core.ppm.pear-builder.php
*/
class PEAR_Builder extends PEAR_Common
{
var $php_api_version = 0;
var $zend_module_api_no = 0;
var $zend_extension_api_no = 0;
var $extensions_built = array();
/**
* @var string Used for reporting when it is not possible to pass function
* via extra parameter, e.g. log, msdevCallback
*/
var $current_callback = null;
// used for msdev builds
var $_lastline = null;
var $_firstline = null;
/**
* PEAR_Builder constructor.
*
* @param object $ui user interface object (instance of PEAR_Frontend_*)
*
* @access public
*/
function PEAR_Builder(&$ui)
{
parent::PEAR_Common();
$this->setFrontendObject($ui);
}
/**
* Build an extension from source on windows.
* requires msdev
*/
function _build_win32($descfile, $callback = null)
{
if (is_object($descfile)) {
$pkg = $descfile;
$descfile = $pkg->getPackageFile();
} else {
$pf = &new PEAR_PackageFile($this->config, $this->debug);
$pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pkg)) {
return $pkg;
}
}
$dir = dirname($descfile);
$old_cwd = getcwd();
if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
return $this->raiseError("could not chdir to $dir");
}
// packages that were in a .tar have the packagefile in this directory
$vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
if (file_exists($dir) && is_dir($vdir)) {
if (!chdir($vdir)) {
return $this->raiseError("could not chdir to " . realpath($vdir));
}
$dir = getcwd();
}
$this->log(2, "building in $dir");
$dsp = $pkg->getPackage().'.dsp';
if (!file_exists("$dir/$dsp")) {
return $this->raiseError("The DSP $dsp does not exist.");
}
// XXX TODO: make release build type configurable
$command = 'msdev '.$dsp.' /MAKE "'.$pkg->getPackage(). ' - Release"';
$err = $this->_runCommand($command, array(&$this, 'msdevCallback'));
if (PEAR::isError($err)) {
return $err;
}
// figure out the build platform and type
$platform = 'Win32';
$buildtype = 'Release';
if (preg_match('/.*?'.$pkg->getPackage().'\s-\s(\w+)\s(.*?)-+/i',$this->_firstline,$matches)) {
$platform = $matches[1];
$buildtype = $matches[2];
}
if (preg_match('/(.*)?\s-\s(\d+).*?(\d+)/', $this->_lastline, $matches)) {
if ($matches[2]) {
// there were errors in the build
return $this->raiseError("There were errors during compilation.");
}
$out = $matches[1];
} else {
return $this->raiseError("Did not understand the completion status returned from msdev.exe.");
}
// msdev doesn't tell us the output directory :/
// open the dsp, find /out and use that directory
$dsptext = join(file($dsp),'');
// this regex depends on the build platform and type having been
// correctly identified above.
$regex ='/.*?!IF\s+"\$\(CFG\)"\s+==\s+("'.
$pkg->getPackage().'\s-\s'.
$platform.'\s'.
$buildtype.'").*?'.
'\/out:"(.*?)"/is';
if ($dsptext && preg_match($regex, $dsptext, $matches)) {
// what we get back is a relative path to the output file itself.
$outfile = realpath($matches[2]);
} else {
return $this->raiseError("Could not retrieve output information from $dsp.");
}
// realpath returns false if the file doesn't exist
if ($outfile && copy($outfile, "$dir/$out")) {
$outfile = "$dir/$out";
}
$built_files[] = array(
'file' => "$outfile",
'php_api' => $this->php_api_version,
'zend_mod_api' => $this->zend_module_api_no,
'zend_ext_api' => $this->zend_extension_api_no,
);
return $built_files;
}
// }}}
// {{{ msdevCallback()
function msdevCallback($what, $data)
{
if (!$this->_firstline)
$this->_firstline = $data;
$this->_lastline = $data;
call_user_func($this->current_callback, $what, $data);
}
/**
* @param string
* @param string
* @param array
* @access private
*/
function _harvestInstDir($dest_prefix, $dirname, &$built_files)
{
$d = opendir($dirname);
if (!$d)
return false;
$ret = true;
while (($ent = readdir($d)) !== false) {
if ($ent{0} == '.')
continue;
$full = $dirname . DIRECTORY_SEPARATOR . $ent;
if (is_dir($full)) {
if (!$this->_harvestInstDir(
$dest_prefix . DIRECTORY_SEPARATOR . $ent,
$full, $built_files)) {
$ret = false;
break;
}
} else {
$dest = $dest_prefix . DIRECTORY_SEPARATOR . $ent;
$built_files[] = array(
'file' => $full,
'dest' => $dest,
'php_api' => $this->php_api_version,
'zend_mod_api' => $this->zend_module_api_no,
'zend_ext_api' => $this->zend_extension_api_no,
);
}
}
closedir($d);
return $ret;
}
/**
* Build an extension from source. Runs "phpize" in the source
* directory, but compiles in a temporary directory
* (/var/tmp/pear-build-USER/PACKAGE-VERSION).
*
* @param string|PEAR_PackageFile_v* $descfile path to XML package description file, or
* a PEAR_PackageFile object
*
* @param mixed $callback callback function used to report output,
* see PEAR_Builder::_runCommand for details
*
* @return array an array of associative arrays with built files,
* format:
* array( array( 'file' => '/path/to/ext.so',
* 'php_api' => YYYYMMDD,
* 'zend_mod_api' => YYYYMMDD,
* 'zend_ext_api' => YYYYMMDD ),
* ... )
*
* @access public
*
* @see PEAR_Builder::_runCommand
*/
function build($descfile, $callback = null)
{
if (preg_match('/(\\/|\\\\|^)([^\\/\\\\]+)?php(.+)?$/',
$this->config->get('php_bin'), $matches)) {
if (isset($matches[2]) && strlen($matches[2]) &&
trim($matches[2]) != trim($this->config->get('php_prefix'))) {
$this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
' appears to have a prefix ' . $matches[2] . ', but' .
' config variable php_prefix does not match');
}
if (isset($matches[3]) && strlen($matches[3]) &&
trim($matches[3]) != trim($this->config->get('php_suffix'))) {
$this->log(0, 'WARNING: php_bin ' . $this->config->get('php_bin') .
' appears to have a suffix ' . $matches[3] . ', but' .
' config variable php_suffix does not match');
}
}
$this->current_callback = $callback;
if (PEAR_OS == "Windows") {
return $this->_build_win32($descfile, $callback);
}
if (PEAR_OS != 'Unix') {
return $this->raiseError("building extensions not supported on this platform");
}
if (is_object($descfile)) {
$pkg = $descfile;
$descfile = $pkg->getPackageFile();
if (is_a($pkg, 'PEAR_PackageFile_v1')) {
$dir = dirname($descfile);
} else {
$dir = $pkg->_config->get('temp_dir') . '/' . $pkg->getName();
// automatically delete at session end
$this->addTempFile($dir);
}
} else {
$pf = &new PEAR_PackageFile($this->config);
$pkg = &$pf->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
if (PEAR::isError($pkg)) {
return $pkg;
}
$dir = dirname($descfile);
}
$old_cwd = getcwd();
if (!file_exists($dir) || !is_dir($dir) || !chdir($dir)) {
return $this->raiseError("could not chdir to $dir");
}
$vdir = $pkg->getPackage() . '-' . $pkg->getVersion();
if (is_dir($vdir)) {
chdir($vdir);
}
$dir = getcwd();
$this->log(2, "building in $dir");
putenv('PATH=' . $this->config->get('bin_dir') . ':' . getenv('PATH'));
$err = $this->_runCommand($this->config->get('php_prefix')
. "phpize" .
$this->config->get('php_suffix'),
array(&$this, 'phpizeCallback'));
if (PEAR::isError($err)) {
return $err;
}
if (!$err) {
return $this->raiseError("`phpize' failed");
}
// {{{ start of interactive part
$configure_command = "$dir/configure";
$configure_options = $pkg->getConfigureOptions();
if ($configure_options) {
foreach ($configure_options as $o) {
$default = array_key_exists('default', $o) ? $o['default'] : null;
list($r) = $this->ui->userDialog('build',
array($o['prompt']),
array('text'),
array($default));
if (substr($o['name'], 0, 5) == 'with-' &&
($r == 'yes' || $r == 'autodetect')) {
$configure_command .= " --$o[name]";
} else {
$configure_command .= " --$o[name]=".trim($r);
}
}
}
// }}} end of interactive part
// FIXME make configurable
if(!$user=getenv('USER')){
$user='defaultuser';
}
$build_basedir = "/var/tmp/pear-build-$user";
$build_dir = "$build_basedir/$vdir";
$inst_dir = "$build_basedir/install-$vdir";
$this->log(1, "building in $build_dir");
if (is_dir($build_dir)) {
System::rm(array('-rf', $build_dir));
}
if (!System::mkDir(array('-p', $build_dir))) {
return $this->raiseError("could not create build dir: $build_dir");
}
$this->addTempFile($build_dir);
if (!System::mkDir(array('-p', $inst_dir))) {
return $this->raiseError("could not create temporary install dir: $inst_dir");
}
$this->addTempFile($inst_dir);
if (getenv('MAKE')) {
$make_command = getenv('MAKE');
} else {
$make_command = 'make';
}
$to_run = array(
$configure_command,
$make_command,
"$make_command INSTALL_ROOT=\"$inst_dir\" install",
"find \"$inst_dir\" | xargs ls -dils"
);
if (!file_exists($build_dir) || !is_dir($build_dir) || !chdir($build_dir)) {
return $this->raiseError("could not chdir to $build_dir");
}
putenv('PHP_PEAR_VERSION=1.9.1');
foreach ($to_run as $cmd) {
$err = $this->_runCommand($cmd, $callback);
if (PEAR::isError($err)) {
chdir($old_cwd);
return $err;
}
if (!$err) {
chdir($old_cwd);
return $this->raiseError("`$cmd' failed");
}
}
if (!($dp = opendir("modules"))) {
chdir($old_cwd);
return $this->raiseError("no `modules' directory found");
}
$built_files = array();
$prefix = exec($this->config->get('php_prefix')
. "php-config" .
$this->config->get('php_suffix') . " --prefix");
$this->_harvestInstDir($prefix, $inst_dir . DIRECTORY_SEPARATOR . $prefix, $built_files);
chdir($old_cwd);
return $built_files;
}
/**
* Message callback function used when running the "phpize"
* program. Extracts the API numbers used. Ignores other message
* types than "cmdoutput".
*
* @param string $what the type of message
* @param mixed $data the message
*
* @return void
*
* @access public
*/
function phpizeCallback($what, $data)
{
if ($what != 'cmdoutput') {
return;
}
$this->log(1, rtrim($data));
if (preg_match('/You should update your .aclocal.m4/', $data)) {
return;
}
$matches = array();
if (preg_match('/^\s+(\S[^:]+):\s+(\d{8})/', $data, $matches)) {
$member = preg_replace('/[^a-z]/', '_', strtolower($matches[1]));
$apino = (int)$matches[2];
if (isset($this->$member)) {
$this->$member = $apino;
//$msg = sprintf("%-22s : %d", $matches[1], $apino);
//$this->log(1, $msg);
}
}
}
/**
* Run an external command, using a message callback to report
* output. The command will be run through popen and output is
* reported for every line with a "cmdoutput" message with the
* line string, including newlines, as payload.
*
* @param string $command the command to run
*
* @param mixed $callback (optional) function to use as message
* callback
*
* @return bool whether the command was successful (exit code 0
* means success, any other means failure)
*
* @access private
*/
function _runCommand($command, $callback = null)
{
$this->log(1, "running: $command");
$pp = popen("$command 2>&1", "r");
if (!$pp) {
return $this->raiseError("failed to run `$command'");
}
if ($callback && $callback[0]->debug == 1) {
$olddbg = $callback[0]->debug;
$callback[0]->debug = 2;
}
while ($line = fgets($pp, 1024)) {
if ($callback) {
call_user_func($callback, 'cmdoutput', $line);
} else {
$this->log(2, rtrim($line));
}
}
if ($callback && isset($olddbg)) {
$callback[0]->debug = $olddbg;
}
$exitcode = is_resource($pp) ? pclose($pp) : -1;
return ($exitcode == 0);
}
function log($level, $msg)
{
if ($this->current_callback) {
if ($this->debug >= $level) {
call_user_func($this->current_callback, 'output', $msg);
}
return;
}
return PEAR_Common::log($level, $msg);
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment